Skip to content

Hydration runs an async memo over latest(...) of a hydrated chain with undefined and re-asks #4376

Closed

Description

@ryansolid

Found by the async app generator's hydration phase (#4371). Reproduces on next 5f60713. It looks like the hydration side of #4363 (latest() returns undefined, which breaks A7), and it also breaks no-refetch.

const [s] = createSignal(3);
function App() {
  const m0 = createMemo(() => fetchA(1 + s()));         // 4
  const m1 = createMemo(() => fetchB(1 + latest(m0)));  // 5
  const m2 = createMemo(() => fetchC(1 + latest(m1)));  // 6
  return (
    <main>
      <Errored fallback={e => "[ROOT-E]"}>
        <Loading fallback="[ROOT-L]">
          <span data-a={String(m2())} />
        </Loading>
      </Errored>
    </main>
  );
}

The server streams all three answers (4, 5, 6) and the fragment <span data-a="6">. A client that hydrates the shell before the chunks arrive calls fetchC(NaN) for real. So latest(m1) returned undefined inside m2's compute during hydration, and that compute asked again instead of claiming the streamed 6.

Expected: no ask before the first client write, and latest() of an uninitialized node throws in every scope, never undefined (A7).

Activity

  1. ryansolid commented on Oct 29, 2026

    @ryansolid
    MemberAuthor

    Fixed on next by #4383 (9baaba3); 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