Skip to content

Commit 4295bad

Browse files
committed
fix(data): unblock persistence for null owner and use correct defaults on retirement
- When createReplica receives a null owner, call decide(false) so served settles immediately and persistence calls proceed through the local store. - On retirement, resolve pending recover calls with [] and cursor calls with null instead of undefined, matching the owner-side fallback and preventing a TypeError when store.recover iterates the result.
1 parent e576727 commit 4295bad

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎packages/octane/src/data/owner.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,8 @@ export function createReplica(
737737
void retireHere();
738738
for (const pending of replies.values()) pending.reject(new DataRetiredError());
739739
replies.clear();
740-
for (const call of asked.values()) call.resolve(undefined);
740+
for (const call of asked.values())
741+
call.resolve(call.op === 'recover' ? [] : call.op === 'cursor' ? null : undefined);
741742
asked.clear();
742743
for (const feed of feeds.values()) feed.end();
743744
}
@@ -926,6 +927,8 @@ export function createReplica(
926927
if (owner) {
927928
connect(owner);
928929
beat = setHostTimeout(heartbeat, HEARTBEAT_MS);
930+
} else {
931+
decide(false);
929932
}
930933
return store;
931934
}

0 commit comments

Comments
 (0)