Skip to content

Bug 2046434 - Dependency Tree: Hide Resolved doesn’t update Max Depth control#2643

Merged
dklawren merged 5 commits into
mozilla-bteam:masterfrom
kyoshino:2046434-tree-depth-ctrl
Jun 11, 2026
Merged

Bug 2046434 - Dependency Tree: Hide Resolved doesn’t update Max Depth control#2643
dklawren merged 5 commits into
mozilla-bteam:masterfrom
kyoshino:2046434-tree-depth-ctrl

Conversation

@kyoshino

Copy link
Copy Markdown
Collaborator

Bug 2046434 - Dependency Tree: Hide Resolved doesn’t update Max Depth control

Make sure the depth control gets updated properly when clicking on the Show/Hide Resolved button or editing the max depth manually using the number input.

@dklawren dklawren left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

updateControls() can crash when a tree update fails

In onAction(), we always call updateControls() right after await updateTrees(...), regardless of whether the fetch succeeded:

this.disableControls();
await this.updateTrees({ maxDepth, hideResolved });
this.updateControls({ maxDepth, hideResolved });

When updateTrees() hits its error path — a network failure or a non-2xx response — it calls showErrorMessage(), which runs with clearContainer: true and does this.$container.innerHTML = ''. That wipes out the tag along with the rest of the container.

Then updateControls() runs and does:

this.realDepth = Number(this.$trees.querySelector('meta[name="real-depth"]').content);

Since the meta tag is gone, querySelector(...) returns null and reading .content throws a TypeError. The user sees the "Failed to load" message, but the toolbar is left fully disabled (because disableControls() already ran and the exception prevents it from being re-enabled), so the widget is stuck and an error is logged to the console.

To reproduce: click any toolbar control while the server is returning an error (e.g. a 500 or a dropped connection).

Suggested fix: guard the meta lookup so a missing tag doesn't crash — e.g. only update realDepth when the meta tag is present, and/or skip updateControls() when the update failed so the controls get re-enabled instead of staying disabled.

@dklawren dklawren left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM r=dkl

@dklawren dklawren merged commit 5a719b8 into mozilla-bteam:master Jun 11, 2026
1 check passed
@kyoshino kyoshino deleted the 2046434-tree-depth-ctrl branch June 11, 2026 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants