Skip to content

Commit ac9ad1f

Browse files
committed
fix
1 parent eee51c4 commit ac9ad1f

File tree

1 file changed

+8
-0
lines changed
  • packages/svelte/src/internal/client

1 file changed

+8
-0
lines changed

packages/svelte/src/internal/client/proxy.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export function proxy(value, onchange) {
2929
}
3030

3131
let batching = false;
32+
let changed_in_batch = false;
3233

3334
/**
3435
* @template T
@@ -200,11 +201,16 @@ export function create_proxy(value, onchanges) {
200201
return function (...args) {
201202
try {
202203
batching = true;
204+
changed_in_batch = false;
203205

204206
// @ts-expect-error
205207
return v.apply(this, args);
206208
} finally {
207209
batching = false;
210+
211+
if (changed_in_batch) {
212+
run_all(onchanges);
213+
}
208214
}
209215
};
210216
}
@@ -293,6 +299,8 @@ export function create_proxy(value, onchanges) {
293299
sources.set(i + '', other_s);
294300
}
295301
}
302+
} else if (batching) {
303+
changed_in_batch = true;
296304
}
297305

298306
// If we haven't yet created a source for this property, we need to ensure

0 commit comments

Comments
 (0)