]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
fix: avoid spread operator even in devtools code
authorEduardo San Martin Morote <posva13@gmail.com>
Tue, 24 Jan 2023 08:10:46 +0000 (09:10 +0100)
committerEduardo San Martin Morote <posva13@gmail.com>
Tue, 24 Jan 2023 08:10:46 +0000 (09:10 +0100)
See #1885

packages/pinia/src/devtools/plugin.ts
packages/pinia/src/store.ts

index b921f5acb1cbba81203a250aa4febc0fdd9e0d63..83b32f532ab812ef681d0fcbe076fd8805f3f024 100644 (file)
@@ -35,6 +35,7 @@ const componentStateTypes: string[] = []
 
 const MUTATIONS_LAYER_ID = 'pinia:mutations'
 const INSPECTOR_ID = 'pinia'
+const { assign } = Object
 
 /**
  * Gets the displayed name of a store in devtools
@@ -420,10 +421,10 @@ function addStoreToDevtools(app: DevtoolsApp, store: StoreGeneric) {
           const eventData: TimelineEvent = {
             time: now(),
             title: formatMutationType(type),
-            data: {
-              store: formatDisplay(store.$id),
-              ...formatEventData(events),
-            },
+            data: assign(
+              { store: formatDisplay(store.$id) },
+              formatEventData(events)
+            ),
             groupId: activeAction,
           }
 
index e4be1beba42bc3fca42c5aa442f8716d61d5d4c0..80e6ee24e75ed4d87955ad128ab456a46b7b89f8 100644 (file)
@@ -674,10 +674,11 @@ function createSetupStore<
     // avoid listing internal properties in devtools
     ;(['_p', '_hmrPayload', '_getters', '_customProperties'] as const).forEach(
       (p) => {
-        Object.defineProperty(store, p, {
-          value: store[p],
-          ...nonEnumerable,
-        })
+        Object.defineProperty(
+          store,
+          p,
+          assign({ value: store[p] }, nonEnumerable)
+        )
       }
     )
   }