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

Hydration Error with elements containing mixture of text and other elements. #3384

Open
dev-inigmas opened this issue Dec 18, 2024 · 2 comments

Comments

@dev-inigmas
Copy link

Describe the bug

Hydration errors are being caused by elements containing a mix of text and other elements (perhaps only components? most testing may be needed).

  • this caused a hydration error:
    <p class="whitespace-nowrap">
      "Updated "
      <DateTimeView time=updated />
    </p>```
  • this does not cause hydration errors:
    <p class="whitespace-nowrap">
      <span>"Updated "</span>
      <DateTimeView time=updated />
    </p>```

Another example:

<div class="col-start-1 col-span-6">
  "Title:"
  <NotificationTitle>{notif_title}</NotificationTitle>
</div>

vs

<div class="col-start-1 col-span-6">
  <span>"Title:"</span>
  <NotificationTitle>{notif_title}</NotificationTitle>
</div>

Leptos Dependencies

leptos        = { version="0.7.1", features=["nightly"] }
leptos_axum   = { version="0.7.1" }
leptos_meta   = { version="0.7.1" }
leptos_router = { version="0.7.1", features=["nightly"] }

To Reproduce

afaik - render view!s with a Transition|Suspense as an ancestor that loads a Resource. I've only tried in a "real" app so far. I can try to get a small example to break later if needed.

Expected behavior

Expected to be able to mix text and elements without hydration errors.

Additional context
If it's needed, let me know, and I'll try to throw together a small sample project.

@gbj
Copy link
Collaborator

gbj commented Dec 18, 2024

Please include a minimal reproduction: i.e., a small, self-contained example that compiles as is, without requiring other code from your project, and reproduces the bug.

@dev-inigmas
Copy link
Author

I was able to reproduce 3385 easily. But this one is proving more elusive - even though I had to scour my app at work for all such instances to get rid of hydration errors. Guess I'll try some more tomorrow.

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

No branches or pull requests

2 participants