Skip to content

Commit

Permalink
fix #1950 leaking error tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
ryansolid committed Nov 22, 2023
1 parent e7ea929 commit fb7f4bc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/olive-frogs-join.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"solid-js": patch
---

fix #1950 leaking error tracking
13 changes: 7 additions & 6 deletions packages/solid/src/reactive/signal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1324,10 +1324,7 @@ export function writeSignal(node: SignalState<any> | Memo<any>, value: any, isCo
function updateComputation(node: Computation<any>) {
if (!node.fn) return;
cleanNode(node);
const owner = Owner,
listener = Listener,
time = ExecCount;
Listener = Owner = node;
const time = ExecCount;
runComputation(
node,
Transition && Transition.running && Transition.sources.has(node as Memo<any>)
Expand All @@ -1346,12 +1343,13 @@ function updateComputation(node: Computation<any>) {
}, false);
});
}
Listener = listener;
Owner = owner;
}

function runComputation(node: Computation<any>, value: any, time: number) {
let nextValue;
const owner = Owner,
listener = Listener;
Listener = Owner = node;
try {
nextValue = node.fn(value);
} catch (err) {
Expand All @@ -1369,6 +1367,9 @@ function runComputation(node: Computation<any>, value: any, time: number) {
// won't be picked up until next update
node.updatedAt = time + 1;
return handleError(err);
} finally {
Listener = listener;
Owner = owner;
}
if (!node.updatedAt || node.updatedAt <= time) {
if (node.updatedAt != null && "observers" in node) {
Expand Down

0 comments on commit fb7f4bc

Please sign in to comment.