Skip to content

[2.0 / next] An uninitialized async memo whose re-run throws from a dependency loses the error; Loading reveals an empty hole #4364

Closed

Description

@ryansolid

Found by the async app generator (packages/web/test/async-gen, branch claude/project-thread-bgafe5), minimized.

const [s, set] = createSignal(0);
let release;
const gate = new Promise(r => (release = r));
render(() => {
  const m0 = createMemo(() => { if (s() === 2) throw new Error("boom"); return s(); });
  const m1 = createMemo(() => { const v = m0() + s(); return gate.then(() => v); });
  return (
    <Errored fallback={e => `[E ${e()?.message}]`}>
      <Loading fallback="[L]"><span>{m1()}</span></Loading>
    </Errored>
  );
}, el);
flush();          // [L]
set(2); flush();  // <span></span>   — expected [E boom]
release(1);       // still <span></span>

The same happens with const v = latest(m0) as m1's only read. With const v = m0() alone, the error reaches <Errored> as expected. So it looks tied to the throw cutting the re-run short before a dependency the previous run had read (or to the throw coming through latest()).

Expected: [E boom] (a fresh render with s = 2 shows it).

Actual on next (1f558e5): the error is dropped, Loading reveals, and the hole shows nothing. This never recovers.

Activity

  1. ryansolid commented on Oct 28, 2026

    @ryansolid
    MemberAuthor

    Fixed on next by #4387 (2861ab8); it ships in the next RC.


    Generated by Claude Code

  2. added 2 commits that reference this issue on Oct 28, 2026
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