Having trouble with $subscribe #1416
-
I have a store that has a Map in it's state like so: export const useItemsStore = defineStore('itemsStore', {
state: () => {
return {
itemsMap: new Map<string, Item>()
}
}
}); Elsewhere in my code I receive messages that update the items in my store like so. let itemsStore = useItemsStore();
let items: Item[] = getItems();
items.forEach((newItem) => {
itemsStore.itemsMap.set(newItem.id, newItem);
}); Finally, in a third place in my code, I've |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Use a |
Beta Was this translation helpful? Give feedback.
Use a
{ flush: 'sync' }
option to$subscribe()
. It works like Vue watchers.