svelte: Svelte 5: List of libraries not working out of the box
Describe the bug
Some libraries don’t work with Svelte 5 out of the box. It will probably be impossible to make every library compatible given that some use stuff svelte/internal (which they really shouldn’t) and everything in there changed, but those who don’t should be closely investigated. Feel free to post libraries you found that don’t work in here, ideally along with a small reproduction (repro or “install and use component X”).
Won’t / can’t fix
@tanstack/svelte-table, because it usessvelte/internalin a way that can’t be backported https://github.com/TanStack/table/issues/5213 - but a new version of the library is underway with Svelte 5 support! In the meantime there’s also a drop-in replacement available at https://www.npmjs.com/package/tanstack-table-8-svelte-5- cmdk-sv / shadcn-svelte search box - manually interacts with the DOM, needs change in the library https://github.com/huntabyte/cmdk-sv/issues/92
- Vercel AI SDK Svelte wrapper - a dependency of that library is using
beforeUpdate, the dependency likely needs to be switched out for something else https://github.com/vercel/ai/issues/3107
Fixed
svelte-confettisvelte-range-slider-pips(through #10543)
Reproduction
Use the libraries and observe errors
Logs
No response
System Info
-
Severity
annoyance
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 36
- Comments: 78 (27 by maintainers)
Commits related to this issue
- fix: only escape characters in SSR template Adjusts the escaping mechanism done for server compilation. For template literals it's now only applied when explicitly told, which is the case for generat... — committed to sveltejs/svelte by dummdidumm 3 years ago
- fix: only escape characters in SSR template (#10555) Adjusts the escaping mechanism done for server compilation. For template literals it's now only applied when explicitly told, which is the case fo... — committed to sveltejs/svelte by dummdidumm 3 years ago
- fix: handle component binding mutation https://github.com/sveltejs/svelte/issues/10359#issuecomment-1991885046 — committed to sveltejs/svelte by dummdidumm 3 years ago
- fix: handle component binding mutation (#10786) * fix: handle component binding mutation https://github.com/sveltejs/svelte/issues/10359#issuecomment-1991885046 * alternative approach to mutati... — committed to sveltejs/svelte by dummdidumm 3 years ago
- fix: handle reassignment of `$$props` and `$$restProps` Some libraries assign to properties of `$$props` and `$$restProps`. These were previously resulting in an error but are now handled properly h... — committed to sveltejs/svelte by dummdidumm 3 years ago
- fix: handle reassignment of `$$props` and `$$restProps` (#11348) * fix: handle reassignment of `$$props` and `$$restProps` Some libraries assign to properties of `$$props` and `$$restProps`. These... — committed to sveltejs/svelte by dummdidumm 3 years ago
- fix: ensure spread events are always added In edge cases it may happen that set_attributes is re-run before the effect is executed. In that case the render effect which initiates this re-run will des... — committed to sveltejs/svelte by dummdidumm 3 years ago
- fix: ensure spread events are always added (#11535) In edge cases it may happen that set_attributes is re-run before the effect is executed. In that case the render effect which initiates this re-run... — committed to sveltejs/svelte by dummdidumm 3 years ago
I just ran LayerChart’s docs using the latest Svelte 5 (5.0.0-next.144 as of writing this) and it was experiencing quite a few problems (all dialogs open by default, non reactive toggles, 100% CPU on some pages, etc). Some of these are likely coming from Svelte UX components as well (which has been pretty good to tease out regressions).
I’ll be investigating these as I get time and hopefully create minimal REPL reproductions when possible, but wanted to give a heads up in case someone else has time to take a look.
I did just log an SVG namespace issue (https://github.com/sveltejs/svelte/issues/11847) that was uncovered.
svelteflow.dev - the following error occurs as soon as the dep is installed
Shadcn-svelte Combobox works in Svelte 4, but doesn’t in Svelte 5. Tried with both, the code is same in both, the only different is svelte version.
I’ve created a repo for the same. The svelte 4 works well, svelte 5 fails - keeps adding new items when trying to filter lists
https://github.com/memestageceo/combobox-4v5.git
PS: Posting it here as I think that Svelte 5 is meant to be backward compatible, but in this case, it isn’t. I don’t know how to figure this out more than this, so kindly clone the repo and test it out. I’ve set up everything for both svelte 4 and svelte 5.
Hey @dummdidumm, we’ve had a few reports on a couple of components with Bits/Melt (Range Calendar being one), as well as a few about https://github.com/huntabyte/cmdk-sv. I’ll confirm and try to put some minimal repros together.
That’s #11429 which was fixed by #11438, release soon
@dummdidumm most of the issues I’m seeing in a few different components consist of the
ERR_SVELTE_TOO_MANY_UPDATES. The functionality appears to work as expected, but the error is displayed in the browser’s console.Reproduction
i’m using shadcn-svelte and trying to get the combo box example working with the current version of svelte 5. I’ve installed all the below dependancies for it to work:
npx shadcn-svelte@latest add popovernpx shadcn-svelte@latest add commandnpm install cmdk-svWhen installing these i need to use
--forceas otherwise i can’t install any of theshadcn-sveltecomponents. I’ve been told that its because it usessvelte/internal. You can see the error i get when trying without force in the second code example below. However more importantly I get the below error when I try to open a page with the combo box element on itError with combo installed using
--forceError when trying to install any
shadcn-sveltecomponent without--forceIt seems like a ton of libraries are using
svelte/internalis there no way to mimic the functionality of the most common things they are doing to greatly reduce the ecosystem fragmentation?Yeah, I did that, but I decided to come at it from the other angle and, following the advice from here, turned rune mode on for the entire app and turned it off for the individual incompatible library.
svelte.config.jsI think it would be helpful to have this info in the documentation.
@vexkiddy seems to be working on the latest version. REPL. Version next.55 is really ancient.
From the linked issue it sounds like you’re setting
runes: truein the compiler options. You shouldn’t be doing this when using any component libraries that are still using Svelte 4 syntax. Instead it’s best to implicitly opt into runes mode on a per file basis by using runes inside your components.Created #11389 to track the devtools integration story
svelte-range-slider-pipsbreaks as tracked in https://github.com/simeydotme/svelte-range-slider-pips/issues/130svelte-confettihas been fixed as of version 1.3.2 https://github.com/Mitcheljager/svelte-confetti/pull/10@jycouet found that the issue was that class instances are not reactive, already discussed here : https://github.com/sveltejs/svelte/issues/11590.
The workaround is to use the
toJsonrepository method : https://remult.dev/docs/ref_repository#tojsonThe underlying problem is that the dependency
sswris using beforeUpdate: https://github.com/ConsoleTVs/sswr/blob/master/src/sswr.ts#L29 Let’s use https://github.com/vercel/ai/issues/3107 to track thisThis sounds like https://github.com/huntabyte/cmdk-sv/issues/92, which isn’t solveable on our end, and needs adjustment in the library.
svelte-sonner no work -> https://github.com/sveltejs/svelte/issues/10359#issuecomment-1949429550
svelte-turnstilebreaks as a result of #8301. If that issue is fixed,svelte-turnstilewill function properly.@attilabuturla I’ve encountered this with LayerChart (maybe why you are reporting 😁) and looks like quite a few libraries are affected (especially those set as
peerDependency)This isn’t a bug, but the svelte-json-tree library should be updated to include Svelte 5 as a peer dependency.
https://github.com/sveltejs/svelte-json-tree/blob/main/package.json#L58
I don’t know if it helps, but I created a PR to take care of it: https://github.com/sveltejs/svelte-json-tree/pull/6
@benmccann They forced
compilerOptions: { runes: true },which affects installed libraries as well (#9632). It works fine when the library is allowed to operate in legacy mode.Please open a separate issue with a proper reproduction
vercel/ai with the
@ai-sdk/svelteis not working due they’re usingsvelte/stores, do not work on Runes mode.Svelte 5: Runes mode
Svelte 5: Compatibility mode
I guess svelte-5 is close to its release. There are only 8 issues left. I have started working towards upgrading svelte-commerce to svelte5
Please open a separate issue with a reproduction for this
next.174 broke svelte material ui (SMUI) by @hperrin https://github.com/hperrin/svelte-material-ui/issues/662
As a temporary workaround I found wrapping the chart in an
{#if}block using a flag that is set to false viabeforeNavigateworks to at least keep the app running, even though the error still logs to the console (without it the app is dead and I have to do a hard page refresh):Using this repl the listeners2 issue happens both when using
npm run devand usingnpm run buildnpm run previewhttps://github.com/sveltejs/svelte/issues/11934#issuecomment-2153020997@dummdidumm Kitbook copies the Svelte DevTools chrome extension use of
SvelteRegisterBlock,SvelteRegisterComponentand thecreate_fragmentm, p, and d functions to build up the active component tree w/ associated dom elements. I’ve looked around a bit (particularly inownership.jsatmark_module_startandmark_module_end) for the equivalents in Svelte 5 but it’s not apparent to me what a good path forward would be. See this comment for a little more context. Do you guys have a plan yet for how the Svelte DevTools is going to track with mounted components and elements? Is this going to need to wait for the final 5.0 release? Thanks!https://github.com/vkurko/calendar
The library is using a lot of svelte/internal
https://github.com/TanStack/table/issues/5213. The svelte wrapper for TanStack Table is using
svelte/internaland thus is broken.svelte-sonnerrepro: https://stackblitz.com/edit/sveltejs-kit-template-default-y7ihkq?file=src%2Froutes%2FCounter.svelteor just install “svelte-sonner” and use component with latest svelte 5 (alpha 68 at this moment)
In the browser console it says:
ERR_SVELTE_TOO_MANY_UPDATES@mquandalle can you provide a reproduction? I tried the code snippet in the related
svelte-range-slider-pipsissue and it’s working for me.@Leftium the bug with the artifact should be fixed through #10555