From: Eduardo San Martin Morote Date: Tue, 24 Jan 2023 08:10:46 +0000 (+0100) Subject: fix: avoid spread operator even in devtools code X-Git-Tag: pinia@2.0.30~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d2a4defc381ae8e023b45b05e4ac8588fe2add9e;p=thirdparty%2Fvuejs%2Fpinia.git fix: avoid spread operator even in devtools code See #1885 --- diff --git a/packages/pinia/src/devtools/plugin.ts b/packages/pinia/src/devtools/plugin.ts index b921f5ac..83b32f53 100644 --- a/packages/pinia/src/devtools/plugin.ts +++ b/packages/pinia/src/devtools/plugin.ts @@ -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, } diff --git a/packages/pinia/src/store.ts b/packages/pinia/src/store.ts index e4be1beb..80e6ee24 100644 --- a/packages/pinia/src/store.ts +++ b/packages/pinia/src/store.ts @@ -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) + ) } ) }