Skip to content

SSR: nullish Title children serialize as literal "undefined" #73

Open

Description

@birkskyum

Summary

During SSR, a nullish child passed to a closing meta element is serialized as literal text. In particular, <Title>{undefined}</Title> produces <title>undefined</title> instead of an empty title.

This is the current, framework-independent core of solidjs/solid-start#1881. The reproduction does not use SolidStart, routing, prerendering, or asynchronous data.

Reproduction

https://github.com/birkskyum/repro-solid-meta-nullish-ssr

git clone https://github.com/birkskyum/repro-solid-meta-nullish-ssr.git
cd repro-solid-meta-nullish-ssr
pnpm install
pnpm repro

Minimal component:

import { MetaProvider, Title } from "@solidjs/meta";
import { renderToString } from "solid-js/web";

const html = renderToString(() => (
  <html>
    <head />
    <body>
      <MetaProvider>
        <Title>{undefined}</Title>
      </MetaProvider>
    </body>
  </html>
));

Actual

<html data-hk="0"><head><title data-sm="2000">undefined</title></head><body></body></html>

Expected

<html data-hk="0"><head><title data-sm="2000"></title></head><body></body></html>

Cause

renderTags passes the nullish value through escape and then interpolates the result into a template literal. escape(undefined) returns undefined, which template interpolation converts to the string "undefined".

Normalizing the result of flattenChildren with ?? "" before choosing the escaped or unescaped branch avoids stringifying both undefined and null, while preserving valid falsy values such as 0 and false.

Scope

This issue is specifically about serialization of a nullish value. If a title depends on asynchronous route data, the render must still wait for that data (for example with deferStream). The correct output for data that is still unresolved when the shell flushes is an empty title, not the literal word undefined.

Versions

  • @solidjs/meta@0.29.4
  • solid-js@1.9.15
  • vite-plugin-solid@2.11.14
  • vite@8.2.1

Related older falsy-title report: #26

Downstream report: solidjs/solid-start#1881

Proposed fix: #71

Activity

  1. added
    1.x
    on Nov 17, 2026
  2. ryansolid commented on Nov 17, 2026

    @ryansolid
    Member

    Closing as part of the Solid 2.0 cleanup. @solidjs/meta 2.0.0 is a rewrite on top of Solid 2.0's built-in head registry (useHead in @solidjs/web), and the 0.x line that this was reported against isn't getting further changes. If you can still reproduce this on 2.0.0, please open a new issue with a repro.


    Generated by Claude Code

  3. ryansolid commented on Nov 17, 2026

    @ryansolid
    Member

    Reopened, sorry about the noise. This is a Solid 1 line (0.29.x) bug with an open fix PR, so it stays open for a 0.29.x release.


    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

    1.x

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions