* feat: persist UI state * test: fix var declaration * test: increate e2e timeout sometimes there might be a network latency to load CDN assets like the fonts. Let's give the tests a maximum of 1 minute to fully run.
24 lines
546 B
TypeScript
24 lines
546 B
TypeScript
const keys: string[] = [];
|
|
|
|
const render = (key: string) => `nimbus:${key}`;
|
|
|
|
export const uniquePersistenceKey = (key: string): string => {
|
|
if (keys.includes(key)) {
|
|
const newKey = key + '-duplicate';
|
|
|
|
console.warn(`Key ${key} must be unique. '${newKey}' will be used instead.`);
|
|
|
|
return uniquePersistenceKey(newKey);
|
|
}
|
|
|
|
keys.push(key);
|
|
|
|
return render(key);
|
|
};
|
|
|
|
export const clearPersistentKeys = () => {
|
|
keys.forEach((key: string) => {
|
|
window.localStorage.removeItem(render(key));
|
|
});
|
|
};
|