You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(toolbar): add interactive TTFB and LCP waterfall chart to profiler - #316
Replaces the flat stacked bars in the Toolbar Profiler's TTFB Waterfall & LCP 4-Phase Breakdown section with an interactive, staggered multi-row timeline waterfall chart and phase drill-down inspector.
Clicking any waterfall row, LCP sub-segment, or legend item opens a contextual diagnostic drawer (e.g. full render-blocking CSS/JS list with DOM hints and 1-click URL copy, backend cache profile & Server-Timing breakdown, Brotli/Gzip HTML compression ratio, and 4-part LCP breakdown with pre-LCP Long Task culprits and 1-click Inspect Element handoff).
Replace the flat single-bar TTFB and LCP breakdown in the Toolbar Profiler with a staggered multi-row timeline waterfall featuring vertical gridlines, TTFB/FCP/LCP milestone markers, horizontal zoom (1x/2x/4x), All/TTFB/LCP scope switching, and a click-to-inspect phase detail drawer for render-blocking CSS/JS, Server-Timing, and LCP element diagnostics.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The profiler can exclude genuine storefront activity, plot misleading timing phases, and label slow LCP as healthy, undermining the accuracy of its performance diagnostics.
Restrict detached DevTools node detection to UI-owned selectors so audited storefront elements remain tracked, bound LCP resource phase intervals to [ttfbMs, totalMs], keep Server-Timing as duration-only diagnostics, validate total LCP thresholds before emitting healthy tips, and preserve waterfall scroll offset and keyboard focus across snapshot re-renders.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Active issues cause horizontal scroll position to reset when returning to the Profiler tab at 2×/4× zoom and can leave the storefront LCP highlight stuck after a refresh or chart replacement.
A live refresh or chart replacement while the LCP target row is hovered can leave its storefront highlight stuck. Removing the row does not fire mouseleave, and inspector/ui.js:116–142 retains the preview independently of the drawer, taking precedence over the pinned highlight. Clear the preview before replacing the drawer or chart in profiler-waterfall.js / profiler-sections.js, and before clearing the full profiler body in profiler.js.
Guard scrollLeft persistence and restoration behind a positive viewport clientWidth check and defer scroll/focus restoration via ResizeObserver and requestAnimationFrame when renderProfilerContent runs while the Profiler panel is still hidden.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Outstanding issues misclassify compression, leave stale Inspector previews, allow keyboard focus to escape the toolbar, and add repeated document-wide scans during collection.
No open issues 🎉
4 previously missed issues
In code that hasn't changed since last review
Reuse URL-to-element maps across blocking asset lookups
Each blocking stylesheet triggers a fresh document-wide query and array allocation; the JS branch repeats this for every blocking script. Every live snapshot repeats these scans even when the Profiler is closed, adding collector overhead that grows with both the blocking-asset count and the matching DOM nodes. Build URL-to-element maps once per collection pass and reuse them for all entries.
Use encoded body size to measure document compression
transferSize includes HTTP response headers, so it cannot measure body compression. For example, a 1 KB decoded document compressed to 700 B with 500 B of headers is reported as “Uncompressed” here because its transfer size is 1,200 B. Expose navigation encodedBodySize in the collector and compare that with decodedBodySize; keep transferSize only for the separate transfer-size display.
Clear waterfall preview before replacing the hovered row
A live collector update replaces the hovered LCP row without firing mouseleave, leaving its global Inspector preview active and masking the pinned selection. Clear any waterfall-owned preview before removing or replacing its drawer, including snapshot renders in profiler.js and scope/zoom refreshes in profiler-sections.js.
Return focus to the selected row when closing the drawer
Closing the drawer with the keyboard removes the focused close button without moving focus elsewhere. Focus falls back to the document body, outside the toolbar, where the menu's keydown-based focus trap cannot intercept the next Tab. Return focus to the selected waterfall row after closing so keyboard navigation stays in the toolbar.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the flat stacked bars in the Toolbar Profiler's TTFB Waterfall & LCP 4-Phase Breakdown section with an interactive, staggered multi-row timeline waterfall chart and phase drill-down inspector.
What Changed
src/view/frontend/web/js/toolbar/profiler-collector.js)redirectStartMs,dnsStartMs,connectStartMs,requestStartMs,responseStartMs,responseEndMs), splitsTCPhandshake fromTLSnegotiation (secureConnectionStart), enriches render-blocking resource entries with DOM location/attributes (<head>/<body>,media, missingdefer/async), and adds LCP resource transfer/decoded metadata.isMageForgeNode()class matching so clicks inside detached/re-rendered toolbar subviews never leak into storefront INP metrics.src/view/frontend/web/js/toolbar/ui/profiler-waterfall.js,profiler-sections.js)‹ | 1× | ›horizontal zoom (1×,2×,4×with sticky phase labels) andAll | TTFB | LCPscope switching (includingServer-Timingsub-rows inTTFBmode and individual 4-phase rows inLCPmode).src/view/frontend/web/js/toolbar/ui/profiler-waterfall-details.js)Server-Timingbreakdown, Brotli/Gzip HTML compression ratio, and 4-part LCP breakdown with pre-LCP Long Task culprits and 1-click Inspect Element handoff).src/view/frontend/web/css/toolbar/_variables.css,_themes.css,_groups.css,_responsive.css)--mageforge-*design tokens across Dark, Light, and Auto themes with zero rawrgba()rules outside_variables.css/_themes.css.Verification
ddev phpcs(217/217 files clean)ddev phpstan(0 errors)ddev mago lint,ddev mago fmt --check,ddev mago analyze(0 issues)trunk check(Prettier & git-diff-check clean)https://mageforge.ddev.site/acrossAll/TTFB/LCPscopes,1×/2×/4×zoom, phase detail drawers, and Dark/Light themes.