fix(ui): de-duplicate clan uris when adding to local storage

This commit is contained in:
Brian McGee
2025-08-20 10:34:53 +01:00
parent cb679dbee2
commit 5c08893db0

View File

@@ -59,8 +59,20 @@ const clanURIs = (): string[] => store.clanURIs;
*
*/
const addClanURI = (uri: string) => {
setStore("clanURIs", store.clanURIs.length, uri);
setStore("sceneData", uri, {}); // Initialize empty scene data for every new clan URI
setStore(
produce((state) => {
// check if it's already in the list
if (state.clanURIs.find((clanURI) => clanURI == uri)) {
return;
}
// otherwise add it
state.clanURIs = [...state.clanURIs, uri];
// initiliase empty scene data
state.sceneData[uri] = {};
}),
);
};
/**