Skip to content

Commit dd1cd06

Browse files
authored
fix: prevent access of Svelte 5-only untrack function (#14658)
Fixes #14657
1 parent a2d186e commit dd1cd06

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

.changeset/thick-ideas-mate.md

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: prevent access of Svelte 5-only `untrack` function

packages/kit/src/runtime/form-utils.svelte.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
/** @import { StandardSchemaV1 } from '@standard-schema/spec' */
44

55
import { DEV } from 'esm-env';
6-
import { untrack } from 'svelte';
6+
import * as svelte from 'svelte';
7+
// Svelte 4 and under don't have `untrack` - you'll not be able to use remote functions with Svelte 4 but this will still be loaded
8+
const untrack = svelte.untrack ?? ((value) => value());
79

810
/**
911
* Sets a value in a nested object using a path string, not mutating the original object but returning a new object

0 commit comments

Comments
 (0)