Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/serious-bulldogs-beam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

fix: avoid creating update check timer on the server
8 changes: 4 additions & 4 deletions packages/kit/src/runtime/client/singletons.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ export function client_method(key) {
}

export const stores = {
url: notifiable_store({}),
page: notifiable_store({}),
navigating: writable(/** @type {import('types').Navigation | null} */ (null)),
updated: create_updated_store()
url: /* @__PURE__ */ notifiable_store({}),
page: /* @__PURE__ */ notifiable_store({}),
navigating: /* @__PURE__ */ writable(/** @type {import('types').Navigation | null} */ (null)),
updated: /* @__PURE__ */ create_updated_store()
};
9 changes: 7 additions & 2 deletions packages/kit/src/runtime/client/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,15 +219,20 @@ export function notifiable_store(value) {
export function create_updated_store() {
const { set, subscribe } = writable(false);

if (DEV || !BROWSER) {
return {
subscribe,
check: async () => false
};
}

const interval = __SVELTEKIT_APP_VERSION_POLL_INTERVAL__;

/** @type {NodeJS.Timeout} */
let timeout;

/** @type {() => Promise<boolean>} */
async function check() {
if (DEV || !BROWSER) return false;

clearTimeout(timeout);

if (interval) timeout = setTimeout(check, interval);
Expand Down