Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use vuex instead EventBus #809

Closed
wants to merge 2 commits into from
Closed

Use vuex instead EventBus #809

wants to merge 2 commits into from

Conversation

IvayloPapazov
Copy link

close #660

@mradkov
Copy link
Contributor

mradkov commented Sep 23, 2020

Some tests are failing, can you address that?

@@ -137,8 +136,11 @@ export default {
mounted() {
this.reloadData();

EventBus.$on('reloadData', () => {
this.reloadData();
this.$watch(() => this.reloading, (reload) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like overhead to me, whats the benefit of this change?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understood correctly the removal of the event bus.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the benefit of removing the event bus is removing the event bus, whats the benefit of this change actually?

@@ -53,7 +52,7 @@ export default {
(data) => client.signMessage(data),
this.parentId,
);
EventBus.$emit('reloadData');
this.$store.commit('reloading', true);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with committing to the store to me its not implicit whats happening, emitting some event is way more clear

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is your proposal? Should we leave the old implementation?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my proposal is to remove the event bus, but not by emulating an event bus with vuex, but use vuex as intended or imagined (cc @davidyuk )

@@ -5,6 +5,7 @@ import mutations from './mutations';
import backend from './modules/backend';
import persistState from './plugins/persistState';
import modals from './plugins/modals';
/* eslint import/no-cycle: [2, { maxDepth: 1 }] */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should avoid cyclic dependencies

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. To avoid this, most of the current implementation needs to be changed.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, that would be necessary

@CedrikNikita
Copy link
Collaborator

CedrikNikita commented Sep 24, 2020

As i undestood, the main idea of dropping EvenBus from Denis, was to drop this workaround behaviour of emitting reset from each component.
Denis words:
I think the store should itself update the state (of the component that is displayed) after calling the action.

@thepiwo
Copy link
Collaborator

thepiwo commented Sep 25, 2020

As @CedrikNikita @davidyuk say, I think we should keep a event emit if we need event emit, but have the store update the state

@davidyuk
Copy link
Member

davidyuk commented Oct 7, 2020

will be reimplemented in #817, #819, and future PRs

@davidyuk davidyuk closed this Oct 7, 2020
@davidyuk davidyuk deleted the vuex branch October 7, 2020 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use vuex instead EventBus pattern
5 participants