Skip to content

Commit

Permalink
Fix: always reset the evaluation context upon entering an untracked b…
Browse files Browse the repository at this point in the history
…lock
  • Loading branch information
jviide committed Feb 28, 2024
1 parent d9d4161 commit a5b6ccd
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,19 +99,12 @@ function batch<T>(callback: () => T): T {
// Currently evaluated computed or effect.
let evalContext: Computed | Effect | undefined = undefined;

let untrackedDepth = 0;

function untracked<T>(callback: () => T): T {
if (untrackedDepth > 0) {
return callback();
}
const prevContext = evalContext;
evalContext = undefined;
untrackedDepth++;
try {
return callback();
} finally {
untrackedDepth--;
evalContext = prevContext;
}
}
Expand Down

0 comments on commit a5b6ccd

Please sign in to comment.