Skip to content

Commit 4aa66d5

Browse files
committed
Enhance state management by updating badgesValues computation and adding watch for identity state
1 parent 0bd3f19 commit 4aa66d5

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/components/appbar/RightButtons.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,16 @@ import { ref } from 'vue'
2828
let settings = ref(false)
2929
3030
const identityStateStore = useIdentityStateStore()
31+
const stateValue = ref(0)
32+
33+
watch(
34+
() => identityStateStore.getStateValue('a_synchroniser'),
35+
(newValue) => (stateValue.value = newValue),
36+
{ immediate: true },
37+
)
3138
3239
const badgesValues = ref({
33-
TO_SYNC: computed(() => (identityStateStore.getToSyncCount > 9999 ? '9999+' : identityStateStore.getToSyncCount)),
40+
TO_SYNC: computed(() => (stateValue.value > 9999 ? '9999+' : stateValue.value)),
3441
})
3542
3643
const auth = useAuth()

src/stores/identityState.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ export const useIdentityStateStore = defineStore('identityStates', {
88
counters: {},
99
}),
1010
getters: {
11-
getStateValue: (state) => (key: IdentityState) => state.counters[key],
11+
12+
getStateValue: (state) => (key: IdentityState | string) => state.counters[key],
1213
},
1314
actions: {
1415
async initialize(filters = {}) {

0 commit comments

Comments
 (0)