mirror of
https://github.com/Radarr/Radarr
synced 2025-12-06 08:28:50 +01:00
New: Improve stored UI settings for multiple instances under the same host
Closes #10671 Fixes #11146 (cherry picked from commit 6677fd11168de6dbf78d03bfedf67b89dfe1df53)
This commit is contained in:
parent
43762f8658
commit
03f53b595e
1 changed files with 9 additions and 1 deletions
|
|
@ -96,14 +96,22 @@ function merge(initialState, persistedState) {
|
|||
return computedState;
|
||||
}
|
||||
|
||||
const KEY = 'radarr';
|
||||
|
||||
const config = {
|
||||
slicer,
|
||||
serialize,
|
||||
merge,
|
||||
key: 'radarr'
|
||||
key: window.Radarr.instanceName.toLowerCase().replace(/ /g, '_') || KEY
|
||||
};
|
||||
|
||||
export default function createPersistState() {
|
||||
// Migrate existing local storage value to new key if it does not already exist.
|
||||
// Leave old value as-is in case there are multiple instances using the same key.
|
||||
if (config.key !== KEY && localStorage.getItem(KEY) && !localStorage.getItem(config.key)) {
|
||||
localStorage.setItem(config.key, localStorage.getItem(KEY));
|
||||
}
|
||||
|
||||
// Migrate existing local storage before proceeding
|
||||
const persistedState = JSON.parse(localStorage.getItem(config.key));
|
||||
migrate(persistedState);
|
||||
|
|
|
|||
Loading…
Reference in a new issue