Skip to content

Commit d2a4def

Browse files
committed
fix: avoid spread operator even in devtools code
See #1885
1 parent 26b72f3 commit d2a4def

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

packages/pinia/src/devtools/plugin.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ const componentStateTypes: string[] = []
3535

3636
const MUTATIONS_LAYER_ID = 'pinia:mutations'
3737
const INSPECTOR_ID = 'pinia'
38+
const { assign } = Object
3839

3940
/**
4041
* Gets the displayed name of a store in devtools
@@ -420,10 +421,10 @@ function addStoreToDevtools(app: DevtoolsApp, store: StoreGeneric) {
420421
const eventData: TimelineEvent = {
421422
time: now(),
422423
title: formatMutationType(type),
423-
data: {
424-
store: formatDisplay(store.$id),
425-
...formatEventData(events),
426-
},
424+
data: assign(
425+
{ store: formatDisplay(store.$id) },
426+
formatEventData(events)
427+
),
427428
groupId: activeAction,
428429
}
429430

packages/pinia/src/store.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -674,10 +674,11 @@ function createSetupStore<
674674
// avoid listing internal properties in devtools
675675
;(['_p', '_hmrPayload', '_getters', '_customProperties'] as const).forEach(
676676
(p) => {
677-
Object.defineProperty(store, p, {
678-
value: store[p],
679-
...nonEnumerable,
680-
})
677+
Object.defineProperty(
678+
store,
679+
p,
680+
assign({ value: store[p] }, nonEnumerable)
681+
)
681682
}
682683
)
683684
}

0 commit comments

Comments
 (0)