Merge pull request 'fix(ui): de-duplicate clan uris when adding to local storage' (#4831) from ui/deduplicate-clan-storage into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/4831
This commit is contained in:
@@ -59,8 +59,20 @@ const clanURIs = (): string[] => store.clanURIs;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
const addClanURI = (uri: string) => {
|
const addClanURI = (uri: string) => {
|
||||||
setStore("clanURIs", store.clanURIs.length, uri);
|
setStore(
|
||||||
setStore("sceneData", uri, {}); // Initialize empty scene data for every new clan URI
|
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] = {};
|
||||||
|
}),
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user