Skip to content

Commit

Permalink
fix activation observe re-running itself
Browse files Browse the repository at this point in the history
  • Loading branch information
jmeistrich committed Nov 21, 2023
1 parent 921c34e commit 1bc3d25
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/persist/persistActivateNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,10 @@ export function persistActivateNode() {
},
}) as unknown as Observable<WithState>;

if (newValue === undefined) {
const nodeVal = getNodeValue(node);
if (nodeVal !== undefined) {
newValue = nodeVal;
} else if (newValue === undefined) {
newValue = initial;
}

Expand Down
2 changes: 1 addition & 1 deletion src/persist/persistObservable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ async function loadLocal<T>(

localState.persistenceLocal = persistenceLocal;

if (!initialized.get()) {
if (!initialized.peek()) {
await when(initialized);
}

Expand Down

0 comments on commit 1bc3d25

Please sign in to comment.