-
Notifications
You must be signed in to change notification settings - Fork 37
Migrate to Runes #156
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
Comments
Thanks for letting me know. I’m waiting for the full Svelte 5 release before figuring out what form LayerCake takes. Given that the library is a collection of stores and stores are no more, it will mean a significant rewrite. |
I may be able to help out with that... I do dataviz, performance and low level for a living. Check out https://github.com/nestauk/svizzle It doesn't use LayerCake (yet) but a port is planned. It will have to wait for a new LayerCake release however. |
Great – thanks for the offer! The first approach I plan on trying will be to replace every store with a Slots are also deprecated so there will have to be some changes there, too. It looks like the existing syntax may work if layout components render a But since Svelte 5 is still a moving target, I think it's better to wait until it settles. |
There's a PR for making this compatible with Svelte 5. I may merge it or may wait until 5.0.0 is out: #190 edit: this has been merged and the library is compatible with Svelte 5 |
FYI the existing LayerCake library works out of the box in Svelte 5 projects. That PR clears up some peerDependency warnings. Eventually I will port LayerCake to using runes but it will require changes to component API. Using $state runes, you can no longer destructure values from contexts like you can with stores import { getContext } from 'svelte';
const { xGet, yGet } = getContext('LayerCake');
// becomes...
const chart = getContext('LayerCake')
chart.xGet
chart.yGet I may include a helper so you're not interacting with import { LayerCake, Svg, getChart } from 'layercake';
const c = getChart();
c.xGet
c.YGet The design is still TBD but that approach seems to help with the ergonomics. Feedback welcome. |
A note on the timing for this: Since the library is compatible with Svelte 4 and 5 but a migration to runes will cut off support for anything less than Svelte 5, I'm not in a huge rush to do that. It may make most sense to wait for something like Svelte 6 when some of the features Layer Cake uses become deprecated. The goal here being that it works for the largest number of people. |
This PR will update the library to Svelte 5 now that 5.0.0 is released: #242 |
I'm curious whether you had a chance to think more about Layer Cake and Svelte 5. I'm wondering whether it would make sense to move forward to Svelte 5. Layer Cake is fairly small so people with legacy projects could continue with an old version. In a Svelte 5 project I find the switching between the different modes confusing when I use Layer Cake old-style components. I am happy to help with anything that might help with that, be it finishing the TypeScript additions (#218) or improved testing (#244). |
Thanks for the help! I feel like there are a few sub-projects with this
So, one approach would be start with 3, then do 4 and then 1 and 2. Because I don't yet know exactly what the best new API will be for runes, I'm inclined to do the steps in the order listed above, which provides the quickest path for users to move away from the old-style Svelte syntax. To turn this post into something actionable, I would say that the two issues you pointed out, #218 and #244 are good ones to start with. As I think about it, I'm not sure that 1i is really necessary. Maybe it's fine if we just migrate all of the examples on the site to runes. Here's an issue for that #255. |
The website's inner workings (2) need to be updated before the components are converted (1), as Svelte 5 components cause errors when run with the current website. I guess 2, 3 (and then 1) can go on step by step and then 4 whenever it's a good time. |
After attempting to port a working Svelte 3/LayerCake app (using
npm i -S --force LayerCake
) I got the error above (ERR_SVELTE_TOO_MANY_UPDATES
).To verify the bug wasn't on my side, I moved an arbitrary working LayerCake REPL example to the Svelte 5 Preview REPL and I get the same error:
Working REPL Example: https://svelte.dev/repl/ad32f9f301484d0cace82272126e9d09?version=3.46.2
Svelte 5 REPL Example (failing)
The text was updated successfully, but these errors were encountered: