Closed lovasoa closed 2 years ago
Hi lovasoa,
this might be related to the Tooltip
property target
(which is not optional).
I'll try to reproduce the issue on my side. You might want to try to pass an empty String as a target in the meantime.
Kai
No, it always throws an error, even if all properties are defined correctly. The component tries to reference objects that are not defined during server-side rendering.
Acording to https://svelte.dev/blog/whats-new-in-svelte-september-2021 HTMLElement is supported starting from svelte 3.42.2. Sveltestrap uses 3.38.2. Would upgrading svelte solve the issue?
The changelog may be a little confusing. Svelte added HTMLElement as a known global during compilation so as not to trigger errors. But is doesn't actually define it, it expects it to be defined by the browser. In SvelteKit, components can be rendered on the server side, where HTMLElement is not defined.
You can reproduce this bug with the latest SvelteKit
Some days ago I reproduced the issue with an older svelte kit application. Just some minutes ago I tried to reproduce the issue with an uptodate svelte kit application (sveltekit next227, svelte 3.46.1) and the issue has vanished. Would you mind doublechecking on your side?
Yes, I can confirm the bug is present with the latest sveltekit. The bug is going to be present as long as sveltestrap tries to reference undefined variables on the server side. The bug is in this repo, not in sveltekit. I was introduced in https://github.com/bestguy/sveltestrap/pull/396
Here is a simple reproduction you can paste into a default sveltekit project initialized with npm init svelte@next my-app
<script>
import { Tooltip } from 'sveltestrap'
</script>
<Tooltip target='xxx'>bug</Tooltip>
<h1 id='xxx'>hello</h1>
Thanks for the fix, will release this weekend.
Hello, It looks like since the latest update the
<ToolTip/>
element is broken and throwsHTMLElement is not defined
when server-side rendered.Initially reported in https://github.com/lovasoa/sanipasse/issues/145