`$subscribe` miss mutations with type of `direct` immediately after`patch` mutations
See original GitHub issuein $subscribe ,I use console
to print the mutations and states when the states change :
store.$subscribe((mutations, state) => {
console.log('states change :', mutations, state);
});
it works correct when I change the state directly or use $pacth
singlely
// the both ways of the follow work correct
// 1. change directly : ouput is { type:‘direct’ ,... }
store.count++
// 2.use $patch : output is {type: 'patch object',...}
store.$patch({
key: `${Math.random()}`,
});
but when I use them together as follow,the mutation with type of ‘direct’ will miss ,there is only {type: ‘patch object’,…} on console , and the count
value printed was still the old value, actually had increased . seem to not be detected ?
store.$patch({
key: `${Math.random()}`,
});
store.count++
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Mastering Mutations in React Query | TkDodo's blog
Mutations are, per design, not directly coupled to queries. A mutation that likes a blog post has no ties towards the query that...
Read more >SARS-CoV-2 Viral Mutations: Impact on COVID-19 Tests | FDA
A mutation (also referred to as viral mutation or genetic mutation) of the severe acute respiratory syndrome coronavirus 2 (SARS-CoV-2) virus ...
Read more >Chapter 12: DNA Damage and Repair – Chemistry
Rarely, a missense mutation may be beneficial. Under the right environmental conditions, this type of mutation may give the organism that harbors it...
Read more >DNA Mutation and Repair
There are three types of DNA Mutations: base substitutions, deletions and insertions. 1. Base Substitutions. Single base substitutions are called point ...
Read more >Oncogenic mutations mimic and enhance dynamic events in ...
The p110α catalytic subunit (PIK3CA) is one of the most frequently mutated genes in cancer. We have examined the activation of the wild-type...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Any way to have access to the mutation path? I have the same problem, I don’t know from which object the mutation is coming.
This might be a caveat that cannot be worked around except by using a
flush: 'sync'
$subscribe()
because currently, in the code, when calling$patch
there isMoving
triggerSubscriptions()
to the nextTick would make this work like you want but break devtools