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

Console warnings on client showing div with zero negative height #291

Open
cliffordkleinsr opened this issue Dec 4, 2024 · 3 comments
Open
Milestone

Comments

@cliffordkleinsr
Copy link

cliffordkleinsr commented Dec 4, 2024

Describe Your Error

When mounting any chart I get the following error on the console from the client:

client.js?v=3aef0bf5:2692 [LayerCake] Target div has zero or negative height. Did you forget to set an explicit height in CSS on the container?

client.js?v=8ae4c4ed:2692 [svelte] reactive_declaration_non_reactive_property
A `$:` statement (node_modules/​layercake/​dist/​LayerCake.svelte:225:1) read reactive state that was not visible to the compiler. Updates to this state will not cause the statement to re-run. The behaviour of this code will change if you migrate it to runes mode

Supporting Attachments

image

This error bloats the client console with successful reloads.

Severity

Annoyance but can be ignored

Package versions

node: v22.11.0
bun: 1.1.38
layerchart: "^0.59.5",
"svelte": "^5.5.3",
"svelte-check": "^4.1.1",

@techniq
Copy link
Owner

techniq commented Dec 4, 2024

Hi @cliffordkleinsr 👋, thanks for the report. This is something I plan to investigate/resolve when I fully migrate to Svelte 5 (runes, snippets). I noticed this started when I updated the docs to run on Svelte 5, and there appears to be some timing difference that I haven't been able to workaround/resolve.

What's interesting is the returned width/height measurements are different if you initially render the page (or refresh) vs going to the page from a link (client side routing). This is with SSR disabled as well

Client navigation (click on link to render new page)

image

Page load (no ssr)

image

LayerCake provides these using bind:clientWidth / bind:clientHeight. In Svelte 5, they now use ResizeObserver instead of a hidden iframe to calculate the dimensions, which might have affected the timings.

Note: there is a non-passive event warning I'm also tracking in #292 to cleanup as well.

@cliffordkleinsr
Copy link
Author

Many thanks and also thank you for the wonderful library. I will await further input as you migrate the library.

@techniq
Copy link
Owner

techniq commented Dec 11, 2024

Looks like reactive_declaration_non_reactive_property warnings might be getting cleaned up in an upcoming release.

sveltejs/svelte#14663

@techniq techniq added this to the v2 milestone Jan 1, 2025
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

2 participants