mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-09 01:13:55 +00:00
refactor: prevent import map collision across stages
This commit is contained in:
committed by
Carlos Valente
parent
1a23287863
commit
d28895ce9c
+6
-2
@@ -1,5 +1,7 @@
|
||||
import { ImportCustom, ImportMap } from 'ontime-utils';
|
||||
|
||||
import { makeStageKey } from '../../../../../../common/utils/localStorage';
|
||||
|
||||
export type NamedImportMap = typeof namedImportMap;
|
||||
|
||||
// Record of label and import name
|
||||
@@ -63,12 +65,14 @@ export function convertToImportMap(namedImportMap: NamedImportMap): ImportMap {
|
||||
};
|
||||
}
|
||||
|
||||
const importMapKey = makeStageKey('import-map');
|
||||
|
||||
export function persistImportMap(options: NamedImportMap) {
|
||||
localStorage.setItem('import-options', JSON.stringify(options));
|
||||
localStorage.setItem(importMapKey, JSON.stringify(options));
|
||||
}
|
||||
|
||||
function getPersistImportMap(): unknown {
|
||||
const options = localStorage.getItem('import-options');
|
||||
const options = localStorage.getItem(importMapKey);
|
||||
if (!options) {
|
||||
throw new Error('no import options found');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user