vuex-router-sync icon indicating copy to clipboard operation
vuex-router-sync copied to clipboard

fix: clone route outside of mutation

Open cjpearson opened this issue 6 years ago • 6 comments
trafficstars

This change moves to call to cloneRoute outside of the mutation and passes the already-cloned route as the payload. It fixes some console errors that might occur when the vue-devtools extension tries to clone the mutation payload. In my case there were errors when it attempted to clone components within the matched array of the route.

cjpearson avatar Nov 05 '19 10:11 cjpearson

Hi thanks for the PR and sorry for the late response. Could you provide the reproduction code for this?

kiaking avatar Apr 23 '20 07:04 kiaking

Closing due to inactivity.

kiaking avatar Apr 30 '20 01:04 kiaking

@kiaking Sorry for the late reply. I've created a demo here. Basically anything that attempts to log or persist mutations can be tripped up by the payload of the ROUTE_CHANGE mutations.

The simplest way to create an error is with a mutation logger which attempts to stringify the payload.

If you attach vue-devtools to the page and enable the new vuex backend, you'll also get errors there as it attempts to clone the mutation. The cloning logic there is different and it doesn't always throw an error when cloning a component.

cjpearson avatar May 07 '20 08:05 cjpearson

@cjpearson Ah, thank you so much for checking in. OK now I see the problem here. Would it be possible for you add a test for this?

kiaking avatar May 09 '20 05:05 kiaking

Yeah I can take a crack at that.

cjpearson avatar May 11 '20 11:05 cjpearson

@cjpearson Thanks a lot! In that case, please rebase the branch to the latest master branch. Now we're writing everything in TS 👍

kiaking avatar May 11 '20 15:05 kiaking