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

SSR error: Component.render(...) is no longer valid in Svelte 5 #1801

Open
harryqt opened this issue Feb 17, 2024 · 4 comments
Open

SSR error: Component.render(...) is no longer valid in Svelte 5 #1801

harryqt opened this issue Feb 17, 2024 · 4 comments
Assignees
Labels
svelte Related to the svelte adapter

Comments

@harryqt
Copy link

harryqt commented Feb 17, 2024

Version:

  • @inertiajs/svelte version: 1.0.14
Starting SSR server on port 13714...
Inertia SSR server started.
1132 |   $$payload.out += `${anchor}</div>`;
1133 |   bind_props($$props, { id, initialPage });
1134 |   pop();
1135 | }
1136 | SSR.render = function() {
1137 |   throw new Error("Component.render(...) is no longer valid in Svelte 5. See https://svelte-5-preview.vercel.app/docs/breaking-changes#components-are-no-longer-classes for more information");
               ^
error: Component.render(...) is no longer valid in Svelte 5. See https://svelte-5-preview.vercel.app/docs/breaking-changes#components-are-no-longer-classes for more information
      at /Users/harry/Projects/laravel-test/bootstrap/ssr/ssr.js:1137:9
      at /Users/harry/Projects/laravel-test/bootstrap/ssr/ssr.js:1175:35
@harryqt harryqt added the svelte Related to the svelte adapter label Feb 17, 2024
@punyflash
Copy link

This is a huge breaking change since Svelte moving to functional components and will require rework for how the app is created. Right now, the server component is hard-coded in the adapter. Ideally, SSR app should be created from setup function exposed to devs in a same way as client rendered to avoid issues like this. I plan to implement it in my adapter soon, but it will require some undocumented steps from developers to configure it properly. As I'm not a fan of rewriting docs just for my adapter, in case there is no decision from inertia team since initial release of Svelte 5, I'll write docs as well.

@punyflash
Copy link

punyflash commented Mar 1, 2024

I was able to implement Svelte 5 SSR support - use @westacks/inertia-svelte@next version of the package. To setup SSR follow the guide here: https://github.com/westacks/inertia-svelte/tree/2.x

@harryqt
Copy link
Author

harryqt commented Mar 3, 2024

Thank you so much for the hard work. I've tested it and it worked perfectly. 🎉

@buhrmi
Copy link
Contributor

buhrmi commented Mar 5, 2024

Nice, I like this more than my implementation. A PR when Svelte 5 is released would be cool

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

No branches or pull requests

4 participants