From 971dcdbf4b825e1791d02a85d6788fa72236107c Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Mon, 8 May 2023 21:02:03 +0200 Subject: [PATCH] feat(devtools): allow resetting setup stores from inspector Close #2189 --- packages/pinia/src/devtools/plugin.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 { -- 2.47.3