Skip to content

2.0.0-beta.14: Server dynamic() renders nothing for Promise component sources #2779

Description

@yumemi-thomas

Describe the bug

In Solid 2.0.0-beta.14, client dynamic() supports Promise component sources through async-aware computation, and the public server dynamic() type also accepts Promise<T>.

However, server dynamic() renders nothing when the source returns a Promise, even when using the async SSR API.

This creates a server/client/API mismatch for async component sources. It is not a Solid 1.x regression; the issue is that the Solid 2 API appears to allow this shape, but the server path silently renders empty output.

Your Example Website or App

https://stackblitz.com/edit/solidjs-templates-tsjnp9k3?file=src%2Fentry-server.tsx

Steps to Reproduce the Bug or Issue

  1. Open the StackBlitz terminal.
  2. Run npm run repro.
  3. Inspect the rendered string.
""

Expected behavior

Server dynamic() should either support Promise component sources in a way that matches the client, or produce an explicit unsupported diagnostic/error.

Because this repro uses renderToStringAsync, the server can wait for the Promise source.

If Promise sources are supported on the server, expected output shape:

<span>Hello Ada</span>

Screenshots or Videos

No response

Platform

  • OS: macOS
  • Runtime: Node.js
  • Version: current next at d8921ac1

Additional context

This appears related to packages/solid-web/server/index.ts: server dynamic() reads the source synchronously and handles only function/string values:

const comp = source(),
  t = typeof comp;

if (comp) {
  if (t === "function") return comp(props);
  else if (t === "string") return ssrElement(comp, props, undefined, true);
}

When source() returns a Promise, typeof comp is "object", so the server returns undefined instead of suspending/waiting or producing an explicit unsupported diagnostic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    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