Skip to content

untrack does not restore listener when callback throws an exception #1323

@LiQuidProQuo

Description

@LiQuidProQuo

Describe the bug

  createEffect(() => {
    try {
      untrack(() => {
        throw new Error();
      });
    } catch (e) {}
    console.log(count()); // this will not be reactive, listener is still null internally
  });

export function untrack<T>(fn: Accessor<T>): T {
let result: T,
listener = Listener;
Listener = null;
result = fn();
Listener = listener;
return result;
}

Your Example Website or App

https://playground.solidjs.com/?hash=1765991341&version=1.4.1

Steps to Reproduce the Bug or Issue

see repro

Expected behavior

untrack should also restore listener when throwing.

Screenshots or Videos

No response

Platform

playground

Additional context

No response

reported by: fabiospampinato

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions