Skip to content

Commit ae600b7

Browse files
authored
Merge pull request #491 from devforth/feature/AdminForth/1293/find-out-why-do-we-unsubscribe
fix: unsubscribe from websocket before subsribing, when we call admin…
2 parents f258533 + c45b8c2 commit ae600b7

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

adminforth/spa/src/stores/core.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ export const useCoreStore = defineStore('core', () => {
9292

9393
// console.log('🔔 subscribeToMenuBadges', mi.badge, JSON.stringify(mi));
9494
if (mi.badge !== undefined) {
95+
websocket.unsubscribe(`/opentopic/update-menu-badge/${mi.itemId}`);
9596
websocket.subscribe(`/opentopic/update-menu-badge/${mi.itemId}`, ({ badge }) => {
9697
mi.badge = badge;
9798
});
@@ -121,8 +122,6 @@ export const useCoreStore = defineStore('core', () => {
121122
item.badge = badge;
122123
}
123124
});
124-
// TODO: This thing was created for something. Find out why
125-
// websocket.unsubscribeAll();
126125
subscribeToMenuBadges();
127126

128127
}

0 commit comments

Comments
 (0)