From b2bb5ba4faf52c41479a7d77490b85016b853229 Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Mon, 29 Mar 2021 19:07:59 +0200 Subject: [PATCH] fix: use assign instead of spread Support old browsers like Edge 17 or Firefox 52 --- src/store.ts | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/store.ts b/src/store.ts index 13fa213b..4b6a2a4a 100644 --- a/src/store.ts +++ b/src/store.ts @@ -42,6 +42,8 @@ function innerPatch( 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 = reactive({ - ...extensions, - ...partialStore, - // using this means no new properties can be added as state - ...computedFromState(pinia.state, $id), - ...computedGetters, - ...wrappedActions, - }) as Store + const store: Store = reactive( + assign( + {}, + extensions, + partialStore, + // using this means no new properties can be added as state + computedFromState(pinia.state, $id), + computedGetters, + wrappedActions + ) + ) as Store // 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 -- 2.47.2