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

[SSR] Transitions may lead to missing elements after hydration #2344

Open
mattersj opened this issue Oct 20, 2024 · 1 comment
Open

[SSR] Transitions may lead to missing elements after hydration #2344

mattersj opened this issue Oct 20, 2024 · 1 comment

Comments

@mattersj
Copy link

Describe the bug

Sometimes transitions may cause missing elements after hydration, especially if a component renders a signal that changes during the rendering process, like in the attached example. Commenting out startTransition wrapper in I18nProvider.tsx fixes the issue.

Your Example Website or App

https://stackblitz.com/edit/github-a26mtb?file=src/app.tsx,src/components/I18nProvider.tsx,src/components/Parent.tsx,src/components/Child.tsx

Steps to Reproduce the Bug or Issue

  1. Open the repro
  2. Pay your attention to Parent and Child components and what they're supposed to render.
  3. You can also refresh the page a few times to see that initially an expected output is rendered on the server but eventually Child component's content is vanished after hydration.

Expected behavior

A correct output from Parent & Child components.

Screenshots or Videos

image

Platform

  System:
    OS: macOS 14.5
    CPU: (10) arm64 Apple M1 Pro
    Memory: 157.41 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.15.1 - ~/.nvm/versions/node/v20.15.1/bin/node
    Yarn: 1.22.22 - ~/.nvm/versions/node/v20.15.1/bin/yarn
    npm: 10.7.0 - ~/.nvm/versions/node/v20.15.1/bin/npm
  Browsers:
    Chrome: 129.0.6668.103
    Safari: 17.5

Additional context

The issue is only reproducible when using SSR.

@mattersj
Copy link
Author

It's worth mentioning that I just stumbled upon another yet similar bug (setup is similar to one in a repro but now I'm using https://github.com/solidjs-community/solid-primitives/tree/main/packages/i18n) where changing a locale during rendering may cause unstable output - sometimes t returns en translation even though a language was explicitly set to fr in the parent component, and sometimes it returns the right translation accounting fr language.
I still haven't managed to get a minimal reproducible example (without a library) and I have some doubts this issue is directly related to Solid but going to leave it here just for additional info that may help.

Screen.Recording.2024-10-21.at.01.47.40.mov

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