From: Eduardo San Martin Morote Date: Mon, 8 May 2023 19:02:03 +0000 (+0200) Subject: feat(devtools): allow resetting setup stores from inspector X-Git-Tag: @pinia/nuxt@0.4.11~26 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=971dcdbf4b825e1791d02a85d6788fa72236107c;p=thirdparty%2Fvuejs%2Fpinia.git feat(devtools): allow resetting setup stores from inspector Close #2189 --- diff --git a/packages/pinia/src/devtools/plugin.ts b/packages/pinia/src/devtools/plugin.ts index b9388485..1bafecfc 100644 --- a/packages/pinia/src/devtools/plugin.ts +++ b/packages/pinia/src/devtools/plugin.ts @@ -118,7 +118,7 @@ export function registerPiniaDevtools(app: DevtoolsApp, pinia: Pinia) { nodeActions: [ { icon: 'restore', - tooltip: 'Reset the state (option store only)', + tooltip: 'Reset the state (with "$reset")', action: (nodeId) => { const store = pinia._s.get(nodeId) if (!store) { @@ -126,9 +126,9 @@ export function registerPiniaDevtools(app: DevtoolsApp, pinia: Pinia) { `Cannot reset "${nodeId}" store because it wasn't found.`, 'warn' ) - } else if (!store._isOptionsAPI) { + } else if (typeof store.$reset !== 'function') { toastMessage( - `Cannot reset "${nodeId}" store because it's a setup store.`, + `Cannot reset "${nodeId}" store because it doesn't have a "$reset" method implemented.`, 'warn' ) } else {