mirror of
https://github.com/Radarr/Radarr
synced 2025-10-06 06:12:42 +02: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:
committed by
Robin Dadswell
parent
43762f8658
commit
03f53b595e
@@ -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);
|
||||
|
Reference in New Issue
Block a user