aeternity / superhero-ui

Superhero UI
https://superhero.com
ISC License
19 stars 21 forks source link

Use vuex instead EventBus pattern #660

Open davidyuk opened 4 years ago

davidyuk commented 4 years ago

Event bus was introduced in https://github.com/aeternity/superhero-ui/commit/18eafe33fd1bacccadcda9ba6b61440c570f6233

davidyuk commented 4 years ago

The issue wasn't well-explained. The idea is to avoid the event bus pattern in general. It is coming somewhere from Backbone, but in Vue it should be doable using Vuex.

I assume that instead of using a global 'reload data' event, our components should dispatch an action (like 'send a tip') and inside that action, we should explicitly update the related state (for example, to update stats in the left panel). There may be a lot of work and I'm proposing to do it step by step.

I think it is reasonable to do it: