Skip to content

Commit 5ad6a0c

Browse files
fix: initialize files bind on hydration (#15059)
1 parent 2ad5195 commit 5ad6a0c

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

.changeset/happy-ants-grin.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: initialize `files` bind on hydration

packages/svelte/src/internal/client/dom/elements/bindings/input.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,15 @@ export function bind_files(input, get, set = get) {
259259
set(input.files);
260260
});
261261

262+
if (
263+
// If we are hydrating and the value has since changed,
264+
// then use the updated value from the input instead.
265+
hydrating &&
266+
input.files
267+
) {
268+
set(input.files);
269+
}
270+
262271
render_effect(() => {
263272
input.files = get();
264273
});

0 commit comments

Comments
 (0)