Skip to content

Commit eee51c4

Browse files
committed
WIP
1 parent df3779d commit eee51c4

File tree

1 file changed

+10
-5
lines changed
  • packages/svelte/src/internal/client

1 file changed

+10
-5
lines changed

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

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -267,12 +267,17 @@ export function create_proxy(value, onchanges) {
267267
var s = sources.get(prop);
268268
var has = prop in target;
269269

270-
if (is_proxied_array && prop === 'length') {
271-
batching = true;
270+
// bail if nothing changed
271+
if (s ? s.v === value : target[prop] === value) {
272+
return true;
272273
}
273274

274-
// variable.length = value -> clear all signals with index >= value
275-
if (is_proxied_array && prop === 'length') {
275+
var is_length_change = is_proxied_array && prop === 'length';
276+
277+
if (is_length_change) {
278+
batching = true;
279+
280+
// variable.length = value -> clear all signals with index >= value
276281
for (var i = value; i < /** @type {Source<number>} */ (s).v; i += 1) {
277282
var other_s = sources.get(i + '');
278283
if (other_s !== undefined) {
@@ -316,7 +321,7 @@ export function create_proxy(value, onchanges) {
316321
);
317322
}
318323

319-
if (is_proxied_array && prop === 'length') {
324+
if (is_length_change) {
320325
batching = false;
321326
}
322327

0 commit comments

Comments
 (0)