From: Eduardo San Martin Morote Date: Wed, 12 May 2021 15:33:25 +0000 (+0200) Subject: feat(devtools): add more data to actions X-Git-Tag: v2.0.0-alpha.17~19 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=e8f4b0e95192ec7d10d380776e7e9e703fe31261;p=thirdparty%2Fvuejs%2Fpinia.git feat(devtools): add more data to actions --- diff --git a/src/devtools/plugin.ts b/src/devtools/plugin.ts index d1c8dabd..5e14011c 100644 --- a/src/devtools/plugin.ts +++ b/src/devtools/plugin.ts @@ -9,6 +9,7 @@ import { ActionsTree, } from '../types' import { + formatDisplay, formatEventData, formatMutationType, formatStoreForInspectorState, @@ -165,18 +166,27 @@ export function addDevtools(app: App, store: Store) { event: { time: Date.now(), title: '🛫 ' + name, - data: args, + subtitle: 'start', + data: { + action: formatDisplay(name), + args, + }, groupId, }, }) - after(() => { + after((result) => { api.addTimelineEvent({ layerId: MUTATIONS_LAYER_ID, event: { time: Date.now(), title: '🛬 ' + name, - data: args, + subtitle: 'end', + data: { + action: formatDisplay(name), + args, + result, + }, groupId, }, }) @@ -188,8 +198,10 @@ export function addDevtools(app: App, store: Store) { event: { time: Date.now(), logType: 'error', - title: '❌ ' + name, + title: '💥 ' + name, + subtitle: 'end', data: { + action: formatDisplay(name), args, error, }, @@ -295,8 +307,11 @@ export function devtoolsPlugin< } } - // FIXME: can this be fixed? - addDevtools(app, store as unknown as Store) + addDevtools( + app, + // @ts-expect-error: FIXME: if possible... + store + ) return { ...wrappedActions } }