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

List getters in Vuex tab #255

Merged
merged 6 commits into from
Mar 14, 2017
Merged

List getters in Vuex tab #255

merged 6 commits into from
Mar 14, 2017

Conversation

AnthonySendra
Copy link
Contributor

@AnthonySendra AnthonySendra commented Feb 15, 2017

Hello,

This PR allows to list all getters defined in the application, just next to the state.

gif0k0igsv

I have a huge application with complex getters, because my state needs to be manipulate (flatten, transformed, ...). Sometimes, it's very difficult to guess the result of the getter according to the state.
In the dev exemple I added a simple getter isPositive that returns true if count is upper or equal than zero.

Implementation:

  • The action vuex/importState doesn't exist anymore. When the user import a state, I send an event through the bridge in order to get updated getters. The bridge will send back the vuex:init event to initialize the state and getters (here).
  • ^ This also fix a bug: the UI was not updated when the state was imported.
  • In the internal store, base and initial have now state and getters as attributes
  • On each mutations, the new value of getters is send (here)

@@ -158,7 +168,7 @@ module.exports = {
.frame('target')
.click('.increment')
.frame(null)
.assert.count('.history .entry', 1)
.assert.count('.history .entry', 4)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because 3 more mutations added

@yyx990803
Copy link
Member

@AnthonySendra thanks for this PR - looking great at the moment, I just need to pull it locally to try it out. Will probably have to do that after shipping Vue core 2.2 though.

@amirrustam
Copy link

#262 can be closed if this is merged.

@yyx990803 yyx990803 merged commit 59e87e8 into vuejs:master Mar 14, 2017
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.

None yet

4 participants