Remove `provideZoneChangeDetection()` from the router tree spec and replace
`fixture.detectChanges()` with `await fixture.whenStable()`.
With zones, the single `detectChanges()` never ran the visualizer's render
effect, so the tree was never drawn. Running zoneless now covers rendering
and the initial snap to root, which relies on the previous fix.
Tested with `pnpm bazel test
//devtools/projects/ng-devtools/src/lib/devtools-tabs/router-tree:test_chromium`.
Snapping to a node starts a 500ms d3 zoom transition that was not
interrupted on dispose. If the tree visualizer is destroyed mid-transition,
d3-zoom keeps reading the size of the now detached SVG and throws
`NotSupportedError: Failed to read the 'value' property from 'SVGLength'`.
Interrupt any running transition in `dispose()`.
Tested with the router tree spec running zoneless (next commit), which fails
with the error above without this change.
Previously, the canvas highlighter spanned across the whole document.
That resulted in a high memory usage since empty canvases still take
memory. This refactor converts the canvas to a `fixed` one, which covers
only the viewport/visible part of the screen.
PR Close#71046
The existing highlighting mechanism relies on DOM elements.
This has some implications like introducing layout thrashing
since each highlight adds/removes elements to and from the tree.
This change converts the higlighter to HTML canvas renderer which
should introduce minimal performance overhead when inspecting the app.
PR Close#71046
Split the `directive-forest/component-tree` logic into other modules and
utilities. `component-tree` was the only remnant of the legacy BE code
organization. The refactor doesn't change any logic, but converts some
remaining arrow functions to standard functions and performs a few renames.
When a later frame has a directive that the first selected frame doesn't,
`mergeFrames` added that frame's directive object to the merged result
by reference. Merging the next frame then added its timings into the
recorded frame, so selecting three or more frames inflated the stored
change detection and lifecycle times, and they grew each time the range
was selected again.
Copy the directive before adding it to the merged result.
Tested by adding a spec that merges three frames and checks that the
input frames are unchanged.
The transfer state backend merges the per-root `ɵgetTransferState` results
into a plain object literal with `Object.assign`. A key such as `__proto__`
assigns through the inherited setter, dropping the entry and reparenting the
merged object. Use a null-prototype object as the merge target so the key is
kept as an ordinary entry.
Remove all prefixes of private members to match the currently followed convention.
Remaining places that still use underscores (excluded from the refactor):
- `tab-update/index.ts`
- `splitArea.directive.ts` (part of the old vendor code)
`FlatTreeControl` from `@angular/cdk/tree` and `MatTreeFlattener` from
`@angular/material/tree` are deprecated in favor of the tree's
`levelAccessor`/`childrenAccessor` APIs.
The component tree (directive forest) isn't rendered with a CDK tree but
as a flat list in a virtual scroll viewport. It only used
`FlatTreeControl` to track which nodes are expanded, and
`MatTreeFlattener` to flatten the forest and compute the visible nodes.
Replace them with:
- An `ExpansionModel` that tracks expanded nodes with a
`SelectionModel`, like `FlatTreeControl` did internally, and exposes
the `expand`, `collapse`, `toggle`, `isExpanded` and `changed` members
used by devtools.
- Local helpers in `ComponentDataSource` that flatten the forest in
depth-first order and return the nodes whose ancestors are all
expanded, matching the previous behavior.
Also add a spec covering which nodes are visible as nodes are expanded
and collapsed.
Since RxJS 7.2, all operators are exported from the main `rxjs` entry
point, and RxJS recommends importing them from there. `rxjs/operators`
is only kept for backward compatibility and is expected to be removed in
a future major version.
Switch the remaining `rxjs/operators` imports in devtools to `rxjs`,
merging them into the existing `rxjs` import where there is one. Unlike
the framework packages, which still support RxJS 6 through their peer
dependency range, devtools is bundled with the repository's RxJS 7, so
this is safe.
No runtime or bundle size changes: both entry points expose the same
tree-shakable operators.
Cleans up `uploadedData` and message bus subscriptions when the profiler
is destroyed to prevent duplicate error dialogs and stale profiler results
from accumulating across profiler instances.
Adds coverage for subscription cleanup on destroy.
In @types/d3-selection >= 3.0.12, listener callbacks for mouseover and mouseout
events are strongly typed to receive MouseEvent. Because PointerEvent is a
subtype of MouseEvent, typing the listener parameter as PointerEvent causes
a TypeScript compilation error.
Update nodeMouseoverListeners and nodeMouseoutListeners in GraphRenderer and the
corresponding D3 event handlers in TreeVisualizer to use MouseEvent.
The CD analyzer previously kept an unbounded array of durations for
each component. Since DevTools only displays the total cycle count and
the latest duration, track the count and latest duration directly as
numbers instead of accumulating an array.
Hide the watch signal button in signal details when the host application
does not support `window.ng.toggleWatchSignal` (e.g. applications running
on Angular versions prior to the introduction of signal watch debugging).
Fixes#70948
When a user cancels Chrome's debugging infobar while a signal breakpoint is active, `chrome.debugger.onDetach` clears the active breakpoints map in the background service worker. Previously, the DevTools panel UI was not notified of this event, leaving the breakpoint icon displayed as active, and subsequently clicking to disable it threw an error because the entry was already absent from `activeBreakpoints`.
This change:
1. Broadcasts a `signalBreakpointsCleared` message from `BreakpointManager` when `chrome.debugger.onDetach` fires so `SignalGraphPaneComponent` immediately clears its active breakpoints state.
2. Makes `BreakpointManager.removeBreakpoint` return early as a no-op if the breakpoint or tab entry is already absent.
Fixes#70949
findErrorNodesForHydrationOverlay recursed into
findNodesForHydrationOverlay, which stops descending at the first node
with any hydration status. Mismatched nodes nested under a hydrated or
skipped node were therefore never found and never highlighted on the
page. Recurse into the error-node finder itself so nested mismatches
are highlighted.
Avoid asserting on chrome.devtools.inspectedWindow.eval directly via
Jasmine matchers, as TypeScript picks up the 3-argument overload
signature from @types/chrome, causing a TS2554 compilation error when
only 2 arguments are provided. Instead, assert directly on the
evalSpy instance.