change(tracker): tracker-vuex 4.0.3

This commit is contained in:
sylenien 2022-09-27 16:45:11 +02:00
parent 8931e118a0
commit 45f3d7b793
2 changed files with 3 additions and 1 deletions

View file

@ -1,7 +1,7 @@
{
"name": "@openreplay/tracker-vuex",
"description": "Tracker plugin for Vuex state recording",
"version": "4.0.2",
"version": "4.0.3",
"keywords": [
"vuex",
"logging",

View file

@ -50,6 +50,7 @@ export default function(opts: Partial<Options> = {}) {
return (storeName: string) => (store) => {
// Vuex
if (store.subscribe) {
app.debug.log('Hooked to vuex store')
const randomId = Math.random().toString(36).substring(2, 9)
store.subscribe((mutation, storeState) => {
state[storeName || randomId] = storeState
@ -59,6 +60,7 @@ export default function(opts: Partial<Options> = {}) {
// Pinia
if (store.$onAction) {
app.debug.log('Hooked to pinia store')
store.$onAction(({ name, store, args }) => {
try {
state[storeName || store.$id] = store.$state;