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.56k stars 435 forks source link

[2.x] Fix `<Deferred />` in Svelte adapter #2037

Closed pedroborges closed 1 month ago

pedroborges commented 1 month ago

In issue #2012, the <Deferred /> component was rendering its default slot before the necessary props were updated, leading to errors when accessing properties on undefined objects. To address this, I updated the <Deferred /> component to subscribe to the $page store and use queueMicrotask skip a beat and switch loaded when the props are expected to be updated.

2036 improves how $page is updated making it more predictable. The approach in this PR resolves the reactivity issue in the <Deferred /> component without modifying the $page store, maintaining compatibility for existing projects.