Bug 2044471 - Add loading indicator to embedded dependency tree - #2637
Conversation
|
Note on the CSS: for simplicity, we could use CSS nesting, which is available in Firefox 117+. However, since Firefox 115 ESR is maintained until August, I have avoided using it. |
dklawren
left a comment
There was a problem hiding this comment.
Suggestions / Nits
- #UPDATE_TREES_ERROR_MESSAGE should be static. It's an immutable constant; as an instance field it's reallocated per DependencyTree instance. static #UPDATE_TREES_ERROR_MESSAGE = ... (referenced as DependencyTree.#UPDATE_TREES_ERROR_MESSAGE) is more accurate. Minor.
- Empty catch {} swallows the error silently. Adding console.error(...) would aid debugging of intermittent fetch failures without changing user-facing behavior:
} catch (ex) { console.error('Failed to load the dependency tree', ex); this.$container.innerHTML = this.#UPDATE_TREES_ERROR_MESSAGE; } - top: 100px is a magic number. For short trees (or the error <p>, which isn't a [role="group"] and so won't be dimmed) the badge may sit oddly relative to content. Not blocking, but a comment or a content-relative value (e.g. centering within the visible area) would be more robust.
- Concurrency: rapid successive calls to updateTrees() each register their own timeout + finally. An earlier call's finally can removeAttribute('aria-busy') while a later in-flight call still expects the busy state. This is an edge case and the pre-existing code already raced on innerHTML, so it's not a regression — but if you want it airtight, track an in-flight counter or abort the prior fetch with AbortController.
|
Resolved the feedback 🙏🏼 |
|
Some issues found during Claude code review just to see any JS issues that I am not an expert of. Please take a look and see if they are real issue that can be resolved before merge. Issues & Risks
Result: a stuck "Updating…" element and a container left in the busy state. This triggers whenever the fetch finishes within ~100ms after the 300ms threshold — plausible in practice. Consider tracking the latest request (e.g. a generation counter or an aborted flag set in finally) and bailing out of showUpdatingMessage() if the fetch already completed, or awaiting the show and checking state before inserting.
and the new this.$numberInput.disabled = false; in updateControllers() have the same exposure. If the input can legitimately be absent, these will throw a TypeError and break the whole update flow. Either confirm it's always present (and drop the ?. elsewhere for consistency) or guard these accesses.
|
|
Claude has solved the issue 1 (race condition) and 3 (unawaited promise). The issue 2 can be ignored because these input elements always exist, and the existence of the wrapper element is checked earlier with |
|
Also fixed some bugs on the number input 🐛 |
Code reviewFound 1 issue:
So the second generation check in Timeline when a fetch lands shortly after the 300ms threshold (common on 300–400ms responses):
The tree is then stuck at 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
|
Claude fixed the issue again 😅 |
Sorry bout that. I must have hit Yes too many times as it submitted the review comment itself. But glad to see it was something worth looking into and was a quick fix. Normally I let Claude loose on a new pull request first, then decide if the change is worth worrying about and then summarize in my own words so I understand it myself. Of course if it is something I can do myself I will just do that. |
dklawren
left a comment
There was a problem hiding this comment.
Issues all resolved and manual testing looks good. r=dkl
Bug 2044471 - Add loading indicator to embedded dependency tree
Add a loading indicator in case the tree update takes more than 300ms.