Skip to content

Commit 1e5d4aa

Browse files
committed
~ Refactor out one loop
1 parent 6067e94 commit 1e5d4aa

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/2n8.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,10 @@ export function createStore<Store extends TwoAndEight>(
6565

6666
const fieldNames = [...getterNames, ...stateNames] as (keyof State<Store>)[]
6767

68-
for (const field of fieldNames) {
69-
storeCache[field] = structuredClone(store[field])
70-
}
71-
7268
const subscribers = {} as Record<keyof State<Store>, Set<() => void>>
7369

7470
for (const field of fieldNames) {
71+
storeCache[field] = structuredClone(store[field])
7572
subscribers[field] = new Set<() => void>()
7673
}
7774

0 commit comments

Comments
 (0)