Skip to content

Commit 9661e6f

Browse files
committed
fix: avoid reading atom value twice
1 parent 3b5741e commit 9661e6f

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/core/store.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@ export const createStore = (
140140
if (!('v' in atomState) || !Object.is(atomState.v, value)) {
141141
atomState.v = value
142142
++atomState.r // increment revision
143+
if (atomState.d.has(atom)) {
144+
atomState.d.set(atom, atomState.r)
145+
}
143146
}
144147
commitAtomState(atom, atomState, dependencies && prevDependencies)
145148
}

0 commit comments

Comments
 (0)