Skip to content

Bring back CommitOptions#silent #2124

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

Open
CoryDHall opened this issue Feb 2, 2022 · 0 comments
Open

Bring back CommitOptions#silent #2124

CoryDHall opened this issue Feb 2, 2022 · 0 comments

Comments

@CoryDHall
Copy link

What problem does this feature solve?

Referencing: #457

The domain the silent option covered is larger than the vue-devtools vuex filter provides.

  • silent prevented commits from propagating to all plugins, not just the devtools
  • the devtools filter does not persist, is not shareable as project config, requires a complex regex to filter out mutations and registration actions, does not resolve dynamic modules well generally, etc.

Use case:

My team is developing a statically generated site with Nuxt.We have an external vendor API that returns deeply nested POJOs modeling has-and-belongs-to-many relationships.

example:

type Entry = { 
  category: { 
    entries: Entry[] 
  } 
}

We have a dynamic module that creates a reference tree to de-dupe objects, resolve circular references, prune and refetch stale data, etc. Loading a module for a page of API results can create hundreds of commits and registrations that are not only irrelevant for day-to-day development, but express a counter-productive level of verbosity and noise. This is compounded by the (slightly unrelated issue) devtools really struggling with keeping track of state generally, and tries to cache references to dynamic modules which are not always present, causing the devtools to hang and crash.

What does the proposed API look like?

commit('SHOW_THIS');
commit('SILENCE_THIS', null, {silent: true})

Where only SHOW_THIS hits devtools/plugins.
Alternatively, a configurable option in the for Mutation<S> following the Action<S> where devs can specify an object:

{
  silent: true,
  handler() {}, // <= every invocation of this is by default silent
}

And even better an option called mute or something in Module or ModuleOptions that makes silent mode the default for the whole MutationTree.

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