We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a9d0bd0 commit 626ec28Copy full SHA for 626ec28
src/2n8.ts
@@ -142,14 +142,14 @@ export function createStore<Store extends TwoAndEight>(
142
if (typeof value === 'function') {
143
throw new TypeError('2n8: Cannot reset a method.')
144
}
145
- const initialValue = initialState[field]
+ const initialValue = structuredClone(initialState[field])
146
if (initialValue !== undefined) {
147
store[field] = initialValue
148
commit(prevState, store.$getState())
149
150
} else {
151
for (const [key, initialValue] of Object.entries(initialState)) {
152
- Reflect.set(store, key, initialValue)
+ Reflect.set(store, key, structuredClone(initialValue))
153
154
155
0 commit comments