ignite / web

Monorepo for packages used by Ignite CLI, including a template, component library and a set of Vuex modules

Home Page:https://ignite.com/cli

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fix subscriptions in Vuex

fadeev opened this issue · comments

subscriptions are added with objects as keys
which means the comparison to see if an action is already subscribed to fails
and it gets readded
(similarly it's impossible to unsuibscribe for)

Change:

		SUBSCRIBE(state, subscription) {
			state._Subscriptions.add(subscription)
		},
		UNSUBSCRIBE(state, subscription) {
			state._Subscriptions.delete(subscription)
		}

To:

		SUBSCRIBE(state, subscription) {
			state._Subscriptions.add(JSON.stringify(subscription))
		},
		UNSUBSCRIBE(state, subscription) {
			state._Subscriptions.delete(JSON.stringify(subscription))
		}

Both in standard Vuex modules as well as in the generated code.

https://github.com/tendermint/starport/blob/6edbc99ff58d7e8c18a2eb2671fd63feebb1d976/starport/pkg/cosmosgen/templates/vuex/store/index.ts.tpl