Skip to content

Commit 81af6ba

Browse files
authored
fix: avoid creating update check timer on the server (#10015)
fixes #10005
1 parent 1c1ddd5 commit 81af6ba

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sveltejs/kit': patch
3+
---
4+
5+
fix: avoid creating update check timer on the server

packages/kit/src/runtime/client/singletons.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ export function client_method(key) {
4444
}
4545

4646
export const stores = {
47-
url: notifiable_store({}),
48-
page: notifiable_store({}),
49-
navigating: writable(/** @type {import('types').Navigation | null} */ (null)),
50-
updated: create_updated_store()
47+
url: /* @__PURE__ */ notifiable_store({}),
48+
page: /* @__PURE__ */ notifiable_store({}),
49+
navigating: /* @__PURE__ */ writable(/** @type {import('types').Navigation | null} */ (null)),
50+
updated: /* @__PURE__ */ create_updated_store()
5151
};

packages/kit/src/runtime/client/utils.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,15 +219,20 @@ export function notifiable_store(value) {
219219
export function create_updated_store() {
220220
const { set, subscribe } = writable(false);
221221

222+
if (DEV || !BROWSER) {
223+
return {
224+
subscribe,
225+
check: async () => false
226+
};
227+
}
228+
222229
const interval = __SVELTEKIT_APP_VERSION_POLL_INTERVAL__;
223230

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

227234
/** @type {() => Promise<boolean>} */
228235
async function check() {
229-
if (DEV || !BROWSER) return false;
230-
231236
clearTimeout(timeout);
232237

233238
if (interval) timeout = setTimeout(check, interval);

0 commit comments

Comments
 (0)