]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
fix: use assign instead of spread
authorEduardo San Martin Morote <posva13@gmail.com>
Mon, 29 Mar 2021 17:07:59 +0000 (19:07 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Mon, 29 Mar 2021 17:07:59 +0000 (19:07 +0200)
Support old browsers like Edge 17 or Firefox 52

src/store.ts

index 13fa213bae2dfaae31f7b846deaa2b9af14f1917..4b6a2a4abf27acef8e190ef4e8f3e15f9a72dbf9 100644 (file)
@@ -42,6 +42,8 @@ function innerPatch<T extends StateTree>(
   return target
 }
 
+const { assign } = Object
+
 /**
  * Create an object of computed properties referring to
  *
@@ -206,21 +208,21 @@ function buildStoreToUse<
   }
 
   const extensions = pinia._p.reduce(
-    (extended, extender) => ({
-      ...extended,
-      ...extender(),
-    }),
+    (extended, extender) => assign({}, extended, extender()),
     {} as PiniaCustomProperties
   )
 
-  const store: Store<Id, S, G, A> = reactive({
-    ...extensions,
-    ...partialStore,
-    // using this means no new properties can be added as state
-    ...computedFromState(pinia.state, $id),
-    ...computedGetters,
-    ...wrappedActions,
-  }) as Store<Id, S, G, A>
+  const store: Store<Id, S, G, A> = reactive(
+    assign(
+      {},
+      extensions,
+      partialStore,
+      // using this means no new properties can be added as state
+      computedFromState(pinia.state, $id),
+      computedGetters,
+      wrappedActions
+    )
+  ) as Store<Id, S, G, A>
 
   // use this instead of a computed with setter to be able to create it anywhere
   // without linking the computed lifespan to wherever the store is first