Skip to content

Commit bb8647e

Browse files
perf: optimize object key iteration in getDepsChanges (#20)
Replaced object spread key extraction with Set-based deduplication to avoid creating large intermediate objects. Added safety checks to handle null/undefined inputs. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: sunnylqm <615282+sunnylqm@users.noreply.github.com>
1 parent 07f4274 commit bb8647e

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/pages/manage/components/bind-package.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,12 @@ function getDepsChanges(
220220
return null;
221221
}
222222
const rows: DepChangeRow[] = [];
223-
const keys = Object.keys({ ...oldDeps, ...newDeps }).sort((a, b) =>
224-
a.localeCompare(b),
225-
);
223+
const keys = Array.from(
224+
new Set([
225+
...Object.keys(oldDeps || {}),
226+
...Object.keys(newDeps || {}),
227+
]),
228+
).sort((a, b) => a.localeCompare(b));
226229
for (const key of keys) {
227230
const oldValue = oldDeps[key];
228231
const newValue = newDeps[key];

0 commit comments

Comments
 (0)