Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(bit-remove): fix "Maximum call stack size exceeded" error when the graph deps is huge #6565

Merged
merged 1 commit into from
Oct 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/bit-id/bit-ids.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,11 @@ export default class BitIds extends Array<BitId> {
return new BitIds(...array);
}

static fromArray(bitIds: BitId[]): BitIds {
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
return new BitIds(...bitIds);
static fromArray(ids: BitId[]): BitIds {
// don't do `new BitIds(...ids);`, it'll throw "Maximum call stack size exceeded" for large number if ids.
const bitIds = new BitIds();
ids.forEach((id) => bitIds.push(id));
return bitIds;
}

static uniqFromArray(bitIds: BitId[]): BitIds {
Expand All @@ -194,7 +196,6 @@ ${found.map((id) => id.toString()).join('\n')}`);

clone(): BitIds {
const cloneIds = this.map((id) => id.clone());
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
return new BitIds(...cloneIds);
}
}