Skip to content

Commit 55b9fbc

Browse files
committed
WIP
1 parent 559d66d commit 55b9fbc

File tree

2 files changed

+12
-2
lines changed
  • packages/svelte

2 files changed

+12
-2
lines changed

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,17 @@ export function create_proxy(value, onchanges) {
201201
v = Reflect.get(target, prop, receiver);
202202

203203
if (is_proxied_array && array_methods.includes(/** @type {string} */ (prop))) {
204-
return batch_onchange(v);
204+
// @ts-expect-error
205+
return function (...args) {
206+
try {
207+
batching = true;
208+
209+
// @ts-expect-error
210+
return v.apply(this, args);
211+
} finally {
212+
batching = false;
213+
}
214+
};
205215
}
206216

207217
return v;

packages/svelte/tests/runtime-runes/samples/state-onchange-arrays/main.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88

99
<button onclick={()=> arr.push(arr.length)}>push</button>
1010
<button onclick={()=>arr.splice(0, 2)}>splice</button>
11-
<button onclick={()=>arr.sort((a,b)=>b-a)}>sort</button>
11+
<button onclick={()=>arr.sort((a,b)=>b-a)}>sort</button>

0 commit comments

Comments
 (0)