-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Describe the bug
After upgrading the SvelteKit dependencies, API calls made to backend servers no longer resolve their promises when the page is reloaded. The issue does not occur when the user navigates between pages — in that case, the promises resolve correctly and data loads as expected.
This behavior appeared after updating to the newer versions of SvelteKit packages.
Temporary Workaround
Downgrading the following packages restores normal behavior:
"@sveltejs/adapter-node": "5.3.1",
"@sveltejs/kit": "2.36.3"
After reverting to these versions, the promises resolve correctly in all cases.
Expected Behavior
API calls should behave consistently between page reloads and client-side navigation. Promises should resolve correctly in both cases.
Reproduction
- Upgrade to the latest versions of @sveltejs/kit and @sveltejs/adapter-node
- Implement an API call inside a load function that fetches data from a backend server
- Reload the page directly
- Observe that the promise for the API call never resolves
- Navigate between pages using client-side routing — observe that it works normally.
Example
+posts.server.ts
export const load: PageLoad = async ({ fetch, depends }) => {
return {
posts: fetch(url('/posts?_limit=5'))
};
};
+page.svelte
<script lang="ts">
export let data: {
posts: Promise<any>;
};
</script>
{#await data.posts}
Loading....
{:then posts}
<ul>
{#each posts as post}
<li>
<h3>{post.title}</h3>
<p>{post.body}</p>
</li>
{/each}
</ul>
{/await}
System Info
System:
OS: macOS
Node: v22.18.0
npm: 10.9.3
Packages:
@sveltejs/kit: [latest version] (❌ causes issue)
@sveltejs/adapter-node: [latest version] (❌ causes issue)
svelte: 5.x
vite: 6.x
Adapter:
Node adapter (using `adapter-node`)
Environment:
Mode: developmentSeverity
blocking an upgrade
Additional Information
This issue seems related to how SvelteKit handles SSR or the load lifecycle during full-page reloads in recent versions. There might be a regression or change in async handling on the server side.