You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The store defines 2 properties on state. The click handler increments both of them simultaneously.
The $subscribe callback prints to the console the resulting mutation
Open the playground and open the browser console.
Click on the button
Expected behavior
either 2 log statements in the console with respective mutations
or 1 event in the console with 1 mutation, but 2 events inside, one for each changed property
Actual behavior
there is only one entry with one mutation event, for prop1.
prop2 is unreported
Additional information
If the change happened on different ticks, as shown here , both events will be reported.
This is probably similar to #992 , but I find the problem more generic.
Basically it means if I have an action that alters several state elements as shown here, my subscribers will miss some of the mutations.
The text was updated successfully, but these errors were encountered:
This is because $subscribe are watchers under the hood. You can get the behavior you want by using flush: 'sync'. It's slightly less performant but that won't matter in 99% of the cases.
Reproduction
https://play.pinia.vuejs.org/#eNqNU01vGjEQ/SvWqhIbBWwoVSJRiGijHNpDWzU97mXZHcDEX7K9BAnx3zu2l2WTVlEOK61n3sy8efY7Zl+MofsGslk2d5XlxhMHvjFElGqzKDLviuyuUFwabT05ksbBo9cWyImsrZZkQFmlG+XBUu8GhSpUpZXDJhG06PD5VcjFKP3gmlWYtYI8l40vPdfqiizuyLFQhIR6LYAKvckH29IYUFAPhqRDfi7UKXZLk7S6F7x6wln5pUkaZKw2k+trLOhHPsbICb85SyvjgnjwII0oPeCJkPmq8V4rsqxCcxSiHYNqpHES5ixhED9nveJsmCW5RrI0dOe0QnEjq6JNoKazxDPEDFe8DJEiY/GfgpOjldXPDlXdIXh4hi7xplgNe6+1cKPS8FS29d64GWNVrRBfg+B7SxV4poxk/9Qsb+gNnTDBVwwHMa5qOLwcgxWjGuR7up+hyzGdfKK3set+2jaVoWtoekK9URbv8MrWfPNKlEpLwwXYnybc70txSiH08/cY87aBjmK1herpP/GdOyTWvyygfHvoreVLuwGf0g+PP+CA/11S6roRiH4j+RvwYTaBY4J9bVSNtHu4yPZbvGOuNn/cw8GDcuelAtGoRsRHme/fWP1Cd0qnPRUvfkMJO2PWsObqlTfja4qmhEOEJcd0Hl70q/JB2xi91noI3/OsdVXe0oqWmpHJeNwuHR01I7dtIDgzfNnpL7afdGw=
Steps to reproduce the bug
The store defines 2 properties on state. The click handler increments both of them simultaneously.
The $subscribe callback prints to the console the resulting mutation
Open the playground and open the browser console.
Click on the button
Expected behavior
either 2 log statements in the console with respective mutations
or 1 event in the console with 1 mutation, but 2 events inside, one for each changed property
Actual behavior
there is only one entry with one mutation event, for prop1.
prop2 is unreported
Additional information
If the change happened on different ticks, as shown here , both events will be reported.
This is probably similar to #992 , but I find the problem more generic.
Basically it means if I have an action that alters several state elements as shown here, my subscribers will miss some of the mutations.
The text was updated successfully, but these errors were encountered: