Skip to content

Commit 1b65938

Browse files
committed
Fix bad loop conversion
1 parent ef102cc commit 1b65938

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/plot_api/helpers.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -523,16 +523,22 @@ const hasCollectionChanged = (oldCollection, newCollection) => {
523523
for (let i = 0; i < oldCollection.length; i++) {
524524
const oldVal = oldCollection[i];
525525
const newVal = newCollection[i];
526-
if (oldVal !== newVal) return isArrayOrObject(oldVal, newVal) ? hasCollectionChanged(oldVal, newVal) : true;
526+
if (oldVal !== newVal) {
527+
const hasChanged = isArrayOrObject(oldVal, newVal) ? hasCollectionChanged(oldVal, newVal) : true;
528+
if (hasChanged) return true;
529+
}
527530
}
528531
} else {
529532
if (Object.keys(oldCollection).length !== Object.keys(newCollection).length) return true;
530533

531534
for (const k in oldCollection) {
532-
if (k.startsWith('_')) return false;
535+
if (k.startsWith('_')) continue;
533536
const oldVal = oldCollection[k];
534537
const newVal = newCollection[k];
535-
if (oldVal !== newVal) return isArrayOrObject(oldVal, newVal) ? hasCollectionChanged(oldVal, newVal) : true;
538+
if (oldVal !== newVal) {
539+
const hasChanged = isArrayOrObject(oldVal, newVal) ? hasCollectionChanged(oldVal, newVal) : true;
540+
if (hasChanged) return true;
541+
}
536542
}
537543
}
538544

0 commit comments

Comments
 (0)