Conversation
`prepareHydration` keyed each persisted store by `node.path.slice(0, -1)` —
the node's ANCESTOR path — while `createStore` looked it up by the current
resource path, which is the same thing. Two keyed siblings therefore share one
hydration entry, so the last one persisted overwrites the others and every
sibling restores its state on the next boot.
The persistence side was already correct: each sibling is saved under its own
`<kebab-name>-<key>` node. Only the restore lookup discarded the segment that
makes them distinct.
Minimal reproduction (before this change, both restore "B"):
function Holder(props: { seed: string }) {
const [state] = createStore({ value: props.seed });
useAsyncOutput({ seed: props.seed }, async (_p, setOutputs) =>
setOutputs({ value: state.value }));
return <></>;
}
<><Holder key="a" seed="A" /><Holder key="b" seed="B" /></>
Both sides now key by the node's own full path. `createStore` runs before
`useAsyncOutput` has pushed the component's segment, so the segment is derived
the same way in both places — extracted into `runtime/identity.ts` because
`render.ts` (the store attach hook) and `instance.ts` (node ids) both need it
and cannot import each other.
This matters for per-entity state: a component rendered per item in a `<For>`
could not own a `createStore` at all, which pushed that state into outputs
purely to work around the collision.
Tests: a new end-to-end regression (keyed siblings each restore their own
store through a real Memory), plus a unit test that a node's store is not
handed to its parent path. Three existing hydration tests encoded the old
`slice(0, -1)` contract and now address nodes by their own path. Full suite
green: 658 creact + 25 testing, typecheck clean.
…boot With the same seeds on both renders, a total hydration failure fell back to those seeds and looked exactly like a successful restore — the test could not tell "restored" from "re-initialized". The second boot now seeds X/Y while still expecting A/B, so only a real restore passes. Verified by reverting the hydration keying: the test fails with ['X','Y'].
fix(store): hydrate a store by its node's own path, not its parent's
|
Warning Review limit reached
Next review available in: 50 minutes Limit details: You’ve used all 1 included review currently available under your plan. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🤖 Grok fallow review — proceedAll gating checks are clean: no dead code, no duplication, no HEALTH threshold breaches, and a clean AUDIT on the single changed file. Release may proceed.
Reviews the full fallow report — dead code, duplication, health, and audit. Re-runs edit this comment. |
Summary
Changes
Type of change
How was this tested?
Checklist
npm testpasses with the coverage gate (100/100/100/100)tscclean (root, packages, website)Related issues