Skip to content

fix(breadcrumbs): handle missing tree element in outline picker#318323

Open
SpencerJung wants to merge 1 commit into
microsoft:mainfrom
SpencerJung:fix/316635-breadcrumbs-tree-element-not-found
Open

fix(breadcrumbs): handle missing tree element in outline picker#318323
SpencerJung wants to merge 1 commit into
microsoft:mainfrom
SpencerJung:fix/316635-breadcrumbs-tree-element-not-found

Conversation

@SpencerJung
Copy link
Copy Markdown

Related Issue

Closes #316635

Summary

BreadcrumbsOutlinePicker._setInput could throw TreeError "Tree element not found" when calling tree.reveal/tree.setFocus on an element that was not yet present in the tree.

Changes

  • Wrap tree.reveal and tree.setFocus calls in try-catch to gracefully handle missing elements

Verification Evidence

  • npm run compile-check-ts-native: PASSED (no TypeScript errors)

Checklist

  • Base branch is main
  • No unauthorized version bump
  • All feasible verification checks attempted
  • No unintended schema or lockfile changes

…osoft#316635)

BreadcrumbsOutlinePicker._setInput could throw TreeError when the
element was not yet present in the tree during reveal/setFocus calls.

- Wrap reveal and setFocus in try-catch to gracefully handle missing elements

Fixes microsoft#316635
Copilot AI review requested due to automatic review settings May 26, 2026 09:36
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR makes the breadcrumbs outline picker more resilient when attempting to reveal/focus an outline element that may not yet exist in the tree.

Changes:

  • Wrap tree.reveal and tree.setFocus in a try/catch to avoid failures when the element isn’t yet present.

Comment on lines +496 to +501
try {
tree.reveal(input.element, 0.5);
tree.setFocus([input.element], this._fakeEvent);
} catch {
// element may not be in tree yet
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Error] unhandlederror-TreeError [BreadcrumbsOutlinePicker] Tree element not found: [object Object]

4 participants