Skip to content

fix(commitTreeBuilder): crash when parentNode.children is undefined#36698

Open
Mohammadreza-Sarvari wants to merge 2 commits into
facebook:mainfrom
Mohammadreza-Sarvari:fix-36596
Open

fix(commitTreeBuilder): crash when parentNode.children is undefined#36698
Mohammadreza-Sarvari wants to merge 2 commits into
facebook:mainfrom
Mohammadreza-Sarvari:fix-36596

Conversation

@Mohammadreza-Sarvari
Copy link
Copy Markdown

@Mohammadreza-Sarvari Mohammadreza-Sarvari commented Jun 5, 2026

Closed #36596

Dear @unstubbable @eps1lon could you please assign #36596 issue to me and review this PR? thanks.

Summary

Guard against undefined children array in CommitTreeBuilder when calling .concat() and .filter() on cloned parent nodes. This fixes a crash in the Profiler flamegraph view: "Cannot read properties of undefined (reading 'concat')" in CommitFlamegraphAutoSizer.
The root cause: getClonedNode spreads an existing node ({...existingNode}), and in some edge cases the node's children field can be undefined, causing the subsequent .concat() or .filter() call to throw.

How did you test this change?

  1. Reproduced the original crash in the DevTools Profiler flamegraph view.
  2. Verified the fix by applying the guard (parentNode.children || []) at both call sites (.concat() at line 258 and .filter() at line 308).
  3. Confirmed no other unguarded .children access in the same file that could cause the same class of error.

@meta-cla
Copy link
Copy Markdown

meta-cla Bot commented Jun 5, 2026

Hi @Mohammadreza-Sarvari!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DevTools Bug] Cannot read properties of undefined (reading 'concat')

1 participant