vuex icon indicating copy to clipboard operation
vuex copied to clipboard

replaceState should trigger subscribe callbacks

Open miaulightouch opened this issue 6 years ago • 5 comments

Version

3.0.1

Reproduction link

https://codepen.io/anon/pen/zajRgg?editors=1010

Steps to reproduce

  1. subscribe a callback
  2. replaceState with any object, and subscribe wouldn't be triggered

What is expected?

subscribe should be triggered

What is actually happening?

it's not.


if replaceState won't fire subscribe callback, vue-devtools would not work properly.

ref: vuejs/vue-devtools#690

miaulightouch avatar Jun 22 '18 08:06 miaulightouch

I see the issue in dev-tools, but think we need a different solution than running subscribe callbacks here.

subscribe is supposed to run when a mutation was committed. When we call replaceState, no mutation is being committed, so it's correct that this callback is not running.

LinusBorg avatar Jun 25 '18 09:06 LinusBorg

I agree that we need a way of getting informed when the state has been replaced.

The lack of this capability is making life difficult with vuex-persisted plugin on production mode (i.e, no scrict mode).

rulrok avatar Sep 24 '18 19:09 rulrok

Is this a duplicate of https://github.com/vuejs/vuex/issues/1448 (or the other way round)?

ghost avatar Dec 10 '18 13:12 ghost

Any movement on this? It's a bit confusing in the dev tools when calling replaceState and they do not update correctly. I looked in the devtools repo and saw this issue https://github.com/vuejs/vue-devtools/issues/690

nek4life avatar Apr 08 '20 17:04 nek4life

any updates on this?

MarcelFinkbeiner avatar Jun 07 '23 15:06 MarcelFinkbeiner