Skip to content

Commit

Permalink
fix stranded effects during hydration cancelation
Browse files Browse the repository at this point in the history
  • Loading branch information
ryansolid committed Aug 27, 2024
1 parent f8ae663 commit 19d0295
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/late-goats-live.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"solid-js": patch
---

fix stranded effects during hydration cancelation
9 changes: 5 additions & 4 deletions packages/solid/src/reactive/signal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1594,13 +1594,14 @@ function runUserEffects(queue: Computation<any>[]) {
sharedConfig.effects || (sharedConfig.effects = []);
sharedConfig.effects.push(...queue.slice(0, userLength));
return;
} else if (sharedConfig.effects) {
queue = [...sharedConfig.effects, ...queue];
userLength += sharedConfig.effects.length;
delete sharedConfig.effects;
}
setHydrateContext();
}
if (sharedConfig.effects && (sharedConfig.done || !sharedConfig.count)) {
queue = [...sharedConfig.effects, ...queue];
userLength += sharedConfig.effects.length;
delete sharedConfig.effects;
}
for (i = 0; i < userLength; i++) runTop(queue[i]);
}

Expand Down
1 change: 1 addition & 0 deletions packages/solid/src/render/hydration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type SharedConfig = {
export const sharedConfig: SharedConfig = {
context: undefined,
registry: undefined,
effects: undefined,
done: false,
getContextId() {
return getContextId(this.context!.count);
Expand Down

0 comments on commit 19d0295

Please sign in to comment.