Skip to content

Resource in title renders "[object Object]" (SSR) #33

Description

@KevinBLT

I am fetching a translation of a string with a resource in a component using <Title>.

Similar to this (in short form):

import { Title } from "@solidjs/meta";
import { createResource, Suspense } from 'solid-js';

export function Text(props) {
  const [ value ] = createResource(props.id, (id) => new Promise(r => setTimeout(() => r('Hello title!'), 100)))

  return (
    <Suspense fallback='&nbsp;'>
      { value() }
    </Suspense>
  );
}

export default function Page() {
  return (
    <>
      <Title><Text id="test" /></Title>
    </>
  );
}

After using renderToStringAsync:

 <title data-sm="0-2-0-0-0-0-0-0-0-0-0-0-0-0-4-0-0-0-0-0">[object Object]</title>

hydrate() function will fix it when the page loads, though.

Activity

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