]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
chore: fix failing tests
authorEduardo San Martin Morote <posva13@gmail.com>
Mon, 8 Mar 2021 13:21:41 +0000 (14:21 +0100)
committerEduardo San Martin Morote <posva13@gmail.com>
Mon, 8 Mar 2021 13:21:41 +0000 (14:21 +0100)
src/devtools.ts

index d6e97242e06e73e36c8b148ff02eae6ddc2937e8..b2538e1bc82f2a8dbb39dc6ac49d09edd9c0b830 100644 (file)
@@ -17,11 +17,7 @@ function formatDisplay(display: string) {
 /**
  * Registered stores used for devtools.
  */
-export const stores = /*#__PURE__*/ new Set<GenericStore>()
-
-export function registerStore(store: GenericStore) {
-  stores.add(store)
-}
+const registeredStores = /*#__PURE__*/ new Set<GenericStore>()
 
 function toastMessage(
   message: string,
@@ -43,7 +39,7 @@ function toastMessage(
 let isAlreadyInstalled: boolean | undefined
 
 export function addDevtools(app: App, store: GenericStore) {
-  registerStore(store)
+  registeredStores.add(store)
   setupDevtoolsPlugin(
     {
       id: 'pinia',
@@ -120,7 +116,7 @@ export function addDevtools(app: App, store: GenericStore) {
 
       api.on.getInspectorTree((payload) => {
         if (payload.app === app && payload.inspectorId === piniaInspectorId) {
-          const stores = Array.from(stores)
+          const stores = Array.from(registeredStores)
 
           payload.rootNodes = (payload.filter
             ? stores.filter((store) =>
@@ -133,7 +129,7 @@ export function addDevtools(app: App, store: GenericStore) {
 
       api.on.getInspectorState((payload) => {
         if (payload.app === app && payload.inspectorId === piniaInspectorId) {
-          const stores = Array.from(stores)
+          const stores = Array.from(registeredStores)
           const store = stores.find((store) => store.$id === payload.nodeId)
 
           if (store) {