inertiajs / inertia

Inertia.js lets you quickly build modern single-page React, Vue and Svelte apps using classic server-side routing and controllers.
https://inertiajs.com
MIT License
6.3k stars 423 forks source link

[Svelte] Improve typescript types + minor fixes #1963

Closed pedroborges closed 3 weeks ago

pedroborges commented 4 weeks ago

Reopening #1881 originally created by @jamesst20.

jamesst20 commented 4 weeks ago

Hey @pedroborges

If you ever reopen the minimal upgrade for Svelte 5, I found a bug this week where I noticed SSR is no longer working with newer build of Svelte 5 starting from next.179+.

You may want to apply this as well

https://github.com/jamesst20/inertia/commit/c8493ab9358fb520461940ef7f043987f0b39d17

This is because Svelte 5 uses anchors (comments) and the div id=app is passed into the render(...) function of Svelte server and it makes anchors outside the div. So when it comes to hydrate the div it completely crash

pedroborges commented 4 weeks ago

Thanks for letting me know @jamesst20, I'll check it out. Really appreciate your work on these PRs 🙇‍♂️

joetannenbaum commented 3 weeks ago

This all looks good, thank you both for all of the work you put into this.

When I fire up the Svelte playground I'm getting a bunch of warnings in the console, I just want to make sure that they aren't a by-product of this PR. Any insight here?

CleanShot 2024-09-11 at 16 46 08@2x

pedroborges commented 3 weeks ago

When I fire up the Svelte playground I'm getting a bunch of warnings in the console, I just want to make sure that they aren't a by-product of this PR. Any insight here?

@joetannenbaum the adapter passes all props from server to every layout and page components. Since each component only declares the props it needs Svelte warns you about the extra ones. You only see these warnings in development so we are good 👍