]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
feat(devtools): allow resetting setup stores from inspector
authorEduardo San Martin Morote <posva13@gmail.com>
Mon, 8 May 2023 19:02:03 +0000 (21:02 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Mon, 8 May 2023 19:02:06 +0000 (21:02 +0200)
Close #2189

packages/pinia/src/devtools/plugin.ts

index b9388485b7c5bb0bfb3f8be64d0ce6bce710af7a..1bafecfc2fb7669a7a442b369f90e4efd72b3996 100644 (file)
@@ -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 {