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

Development mode: Action/mutation log for Vue devtools #6373

Closed
b44rd opened this issue Aug 15, 2017 · 1 comment
Closed

Development mode: Action/mutation log for Vue devtools #6373

b44rd opened this issue Aug 15, 2017 · 1 comment

Comments

@b44rd
Copy link

b44rd commented Aug 15, 2017

What problem does this feature solve?

Referencing to vuejs/devtools#179

A pretty sweet development feature would be to add another tab inside Vue devtools that track the flow of actions and mutations. The suggestion is to allow a function such as devtools.log inside store.dispatch and store.commit that holds the passed params. I´ve been using a custom library to do this for a while (b44rd/jsbug), and it sure provides another level of debuggability. The problem though, is that I currently need to add a line of code inside each action/mutation to achieve this overview.

For instance, when dispatching an action, this might look like this inside a new tab inside Vue devtools:

▶ Action: [actionName] [timestamp]

When clicked, this can be expanded, such as

▼ Action: [actionName] [timestamp]
  {
    points: 1
  }

The result list then visible in Vue devtools might then look like this. Note: Making actions print in a different color than mutations makes it really easy to follow the flow

▶ Action: "init" 10:00:002
▶ Mutation: "INIT" 10:00:004
▶ Action: "jump" 10:01:026
▶ Mutation: "JUMP" 10:01:031
▼ Action: "collectPoint" 10:02:005
  {
    points: 1
  }
▼ Mutation: "SET_STATUS" 10:02:015
  {
    points: 1,
    status: 'hero'
  }

What does the proposed API look like?

I believe it can be an alternative to extend Vue.config to enable/disable this feature. But the overall idea is to enabling vue-devtools to be able to read from two functions, such as

devtools.logAction('actionName', payload)
devtools.logMutation('mutationName', payload)
@b44rd
Copy link
Author

b44rd commented Aug 15, 2017

Closing and instead opening vuejs/vuex#908 as I discover this doesn´t really affect vue.

@b44rd b44rd closed this as completed Aug 15, 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

No branches or pull requests

1 participant