mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-12 19:03:47 +00:00
fix: storage key conflict across stages
This commit is contained in:
committed by
Carlos Valente
parent
efceb930e5
commit
617da68ab5
@@ -1,6 +1,8 @@
|
||||
import { ClientList } from 'ontime-types';
|
||||
import { create } from 'zustand';
|
||||
|
||||
import { makeStageKey } from '../utils/localStorage';
|
||||
|
||||
interface ClientStore {
|
||||
name?: string;
|
||||
setName: (newValue: string) => void;
|
||||
@@ -15,7 +17,7 @@ interface ClientStore {
|
||||
setClients: (clients: ClientList) => void;
|
||||
}
|
||||
|
||||
const clientNameKey = 'ontime-client-name';
|
||||
const clientNameKey = makeStageKey('client-name');
|
||||
|
||||
function persistNameInStorage(newValue: string) {
|
||||
localStorage.setItem(clientNameKey, newValue);
|
||||
|
||||
@@ -3,7 +3,7 @@ import { create } from 'zustand';
|
||||
import { booleanFromLocalStorage } from '../utils/localStorage';
|
||||
|
||||
enum LocalEventKeys {
|
||||
Mirror = 'ontime-view-mirror',
|
||||
Mirror = 'view-mirror',
|
||||
}
|
||||
|
||||
type ViewOptionsStore = {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { baseURI } from '../../externals';
|
||||
|
||||
export function booleanFromLocalStorage(key: string, fallback: boolean): boolean {
|
||||
const valueInStorage = localStorage.getItem(key);
|
||||
if (valueInStorage) {
|
||||
@@ -7,3 +9,8 @@ export function booleanFromLocalStorage(key: string, fallback: boolean): boolean
|
||||
return fallback;
|
||||
}
|
||||
}
|
||||
|
||||
export function makeStageKey(key: string) {
|
||||
if (baseURI) return `${baseURI}-${key}`;
|
||||
return key;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user