Skip to content

Bring back CommitOptions#silent #2124

Open
@CoryDHall

Description

@CoryDHall

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions