Skip to content

2.0.0-beta.15: resolve() never settles (and leaks its root) when the async source rejects #2842

Description

@brenelz

Describe the bug

resolve(fn) is documented to await a reactive expression and return its first fully-settled value as a Promise. When the underlying async source resolves, this works. When it rejects after having been pending, the promise returned by resolve() never settles — it neither resolves nor rejects — and the internal createRoot is never disposed, leaking the root and everything under it.

Typical real-world hit: SSR or a route preloader doing await resolve(...) on data that 404s — the request hangs instead of surfacing the error.

Reproduction

import { createMemo, createRoot, resolve } from "@solidjs/signals";

const delay = (ms: number) => new Promise(r => setTimeout(r, ms));

await createRoot(async () => {
  const m = createMemo(async () => {
    await delay(10);
    throw new Error("boom");
  });

  await resolve(() => m()); // hangs forever — never resolves, never rejects
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions