Skip to content

A memo over latest(m) keeps m's last value when m starts throwing #4377

Closed

Description

@ryansolid

Found by the async app generator's E9 pair, which compares latest(x) read at a leaf with the same read inside a derivation (#4371). Reproduces on next 5f60713.

const [a, setA] = createSignal(0);
const m = createMemo(() => {
  if (a() === 1) throw new Error("boom");
  return a();
});
const d = createMemo(() => latest(m));

render(() => <Errored fallback={e => "[ERR]"}><span>{d()}</span></Errored>, el);        // derive
render(() => <Errored fallback={e => "[ERR]"}><span>{latest(m)}</span></Errored>, el2); // leaf

setA(1);
flush(); // then settle
  • Leaf: [ERR]. This is correct, and it's what a fresh render shows.
  • Derive: <span>0</span>, which never changes. d keeps m's last value instead of rethrowing m's error.

So m is synchronous, but reading it through latest() inside a memo swallows its error. In the generator this is the most common E9 signature: 7 of 1,000 cases.

Activity

  1. added 4 commits that reference this issue on Oct 28, 2026
  2. ryansolid commented on Oct 28, 2026

    @ryansolid
    MemberAuthor

    Fixed on next by #4386 (cbc0eeb); it ships in the next RC.


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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