Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
KevinBLT opened this issue Aug 18, 2023 · 3 comments
Open

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

KevinBLT opened this issue Aug 18, 2023 · 3 comments

Comments

@KevinBLT
Copy link

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.

@KevinBLT
Copy link
Author

@ryansolid Sorry to address this but it's important for me at the moment.
Is this something I am doing wrong?
I use this to fetch the title dynamically in the correct language and for the correct subject of the page. I think this is more or less a common use case (and important for SEO?)

@KevinBLT
Copy link
Author

Is there a Solid SSR playground to share links?

@KevinBLT
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant