diff --git a/client/src/composables/userLocalStorage.ts b/client/src/composables/userLocalStorage.ts index f97388cd2d59..b0aa58b1a9ca 100644 --- a/client/src/composables/userLocalStorage.ts +++ b/client/src/composables/userLocalStorage.ts @@ -13,9 +13,11 @@ import { usePersistentRef } from "./persistentRef"; export function useUserLocalStorage(key: string, initialValue: T, user?: Ref) { const { hashedUserId } = useHashedUserId(user); + let refSyncedRawValue = initialValue; + const storedRef = computed(() => { if (hashedUserId.value) { - return usePersistentRef(`${key}-${hashedUserId.value}`, initialValue); + return usePersistentRef(`${key}-${hashedUserId.value}`, refSyncedRawValue); } else { return ref(initialValue); } @@ -28,6 +30,7 @@ export function useUserLocalStorage(key: string, initialValue: T, user?: Ref< }, set(newValue) { storedRef.value.value = newValue; + refSyncedRawValue = newValue as T; trigger(); }, })); diff --git a/client/src/stores/activityStore.ts b/client/src/stores/activityStore.ts index 466ee226bf00..b74a66286f4d 100644 --- a/client/src/stores/activityStore.ts +++ b/client/src/stores/activityStore.ts @@ -127,10 +127,7 @@ export const useActivityStore = defineScopedStore("activityStore", (scope) => { } }); - // update activities stored in local cache only if changes were applied - if (JSON.stringify(activities.value) !== JSON.stringify(newActivities)) { - activities.value = newActivities; - } + activities.value = newActivities; // if toggled side-bar does not exist, choose the first option if (toggledSideBar.value !== "") {