Commit graph

141 commits

Author SHA1 Message Date
Aleksander Bodurri
33b001d478 fix(devtools): clean up removed directive entries in IdentityTracker to prevent memory leak
The IdentityTracker singleton never deleted entries from its internal
  maps (_currentDirectiveId, _currentDirectivePosition, isComponent) for
  destroyed directives. This caused the maps to grow monotonically for
  the entire DevTools session, retaining references to destroyed component
  instances and preventing garbage collection.

  The cleanup was intentionally commented out because the profiler needs
  to resolve IDs and positions of removed components during recording.

  Introduce `setProfilingActive()` to gate cleanup: when profiling is
  inactive, removed entries are deleted immediately during `index()`.
  When profiling is active, removals are deferred into a `_pendingRemovals`
  set and flushed once profiling stops via `capture.ts` start/stop calls.
2026-04-06 11:36:07 -07:00
Georgi Serev
68a8396baa
refactor(devtools): show appropriate change detection label in the directive tree
Depending on the client app version, either show "OnPush" (pre-v22) or "Eager" (v22+); As part of the change, `APP_DATA` root signal has been introduced along with a minor bug fix related to component metadata displaying.
2026-04-02 11:37:34 -07:00
hawkgs
f3e6698455 refactor(devtools): utilize new unified getControlFlowBlocks API (#66167)
Utilize the new `ng.getControlFlowBlocks` API by refactoring the existing render tree extraction code; Slighly modify @for loop details view

PR Close #66167
2026-03-16 14:17:25 -07:00
Hryhorii Avcharov
41a392d85e feat(devtools): add support for @for control flow blocks in directive explorer (#66167)
- Handle @for data in tree strategies and view extraction
- Show @for details in the UI and property tab
- Persist @for state and update UI accordingly

PR Close #66167
2026-03-16 14:17:25 -07:00
hawkgs
77d7378ffd test(devtools): fix and update flaky component-tree tests
Due to the design of the `ng.getComponent` spy and a race condition where sometimes a `<script>` is added to the test DOM, the `getRootElements` tests used to fail sometimes because those `<script>`s were marked as roots which caused a distortion in the roots count checks. The commit addresses that and also adds an additional test for non-application root Angular components.
2026-03-16 10:03:42 -06:00
hawkgs
9f4c025531 refactor(devtools): improve formatting of injector providers token labels
Use `InjectionToken.toString` for the string representation of `InjectionToken`s for better readibility.
2026-02-17 08:33:41 -08:00
AleksanderBodurri
105274fe32 feat(devtools): mark special element injector providers as internal
Differentiates special providers like ElementRef from other providers in the DevTools UI.
2026-01-26 22:18:02 +00:00
hawkgs
2d4262cfbd fix(devtools): support for @defer-only blocks; defer declared blocks (#66546)
Add support for `@defer`-only blocks (previously, they weren't rendered in the component tree at all); Fix declared blocks section in the details

PR Close #66546
2026-01-20 18:16:32 +00:00
Kristiyan Kostadinov
d9c980a958 build: initial test of TypeScript 6
Resolves some initial test failures after updating to TypeScript 6.
2026-01-15 13:41:01 -08:00
Matthieu Riegler
6a94300179 refactor(devtools): use whenStable instead of detectChanges
This commits migrates the devtools tests toward to recommendations
and runs the tests in a zoneless config
2026-01-05 12:24:58 -05:00
hawkgs
0c4a5c599d fix(devtools): prod app detected screen
Do not call `getSupportedApis` in a prod app since it throws an error due to the absence of `ng`, which prevents the FE from getting the `ngAvailability` message and, respectively, the proper info screen that DevTools cannot be used on a prod app.
2025-12-08 09:21:16 -08:00
Georgi Serev
87e05e935c
refactor(devtools): create a reusable component for all prop mat-trees
Create a reusable component for object property inspection.
2025-12-04 11:44:00 -08:00
hawkgs
a5efc35ddf fix(devtools): router tree callables view source functionality
Fix a set of issues with the callable search algorithm and refactor it.
2025-12-03 10:07:20 +01:00
Matthieu Riegler
a0930e166c refactor(devtools): Use the same error message as the signal custom formatter for signal errors
When signals throw errors on read, the devtools will show the same error message as the signal custom formatter.
We also don't log errors anymore to the console as those might be surprising to see as errors and are buggy behavior of the devtools.
2025-11-26 13:11:07 -05:00
Matthieu Riegler
67d3c2529f refactor(devtools): don't query defer nodes
This prevents from throwing errors when selecting defer nodes
2025-11-21 15:42:54 -05:00
SkyZeroZx
ed0647d2e6 refactor(devtools): add matcher and runGuardsAndResolvers support in router viewer
Enhance the Angular DevTools router viewer to display routes that use custom `matcher` functions and reflect the `runGuardsAndResolvers` configuration
2025-11-18 08:29:41 -08:00
hawkgs
e7a6e31a70 fix(devtools): refine when signal graph button is shown
Show the signal graph button only when a signal-graph-eligible node from the directive explorer is selected; Fix client app error when a `defer` node is selected (related)
2025-11-17 14:45:01 -08:00
hawkgs
d6be289603 fix(devtools): don't round decimal vals previews in the state serializer
The actual numerical data can only be checked in the prop edit mode. This fixes that and makes the real value visible all the time.
2025-11-17 08:39:10 -08:00
SkyZeroZx
373c101d02 refactor(devtools): improve route data and resolver views
Adds an enhanced route data tree view to better visualize both route resolvers and router data.
2025-11-13 09:11:53 -08:00
AleksanderBodurri
cfb26f5999 feat(devtools): use router state for active route detection
Replace URL-based active route detection with direct traversal of the ActivatedRoute tree.

This solution is more reliable than the previous approach because it directly compares router tree configuration objects against the active router instance state with router.routerState.
2025-11-10 09:50:08 -08:00
tsc036
cf47ce2db9
refactor(core): move profile_types.ts to primtives
move profile_types.ts so the types can be used in Wiz code
2025-11-06 14:22:33 -08:00
SkyZeroZx
f2ffbe31b0 refactor(devtools): enhance route guard handling and add inline function warning
refactored route guard handling and added warning for inline functions
2025-11-05 15:20:46 -08:00
hawkgs
cb5d36d107 refactor(devtools): remove redirecting flag from router tree
Drops `isRedirect` due to its redundancy in light of the newly introduced `redirectTo`.
2025-11-05 15:20:29 -08:00
SkyZeroZx
058377ed55 refactor(devtools): handle function-based redirectTo and title in router viewer
Refactors router viewer logic to properly process and display redirectTo and title when defined as functions
2025-11-04 17:54:07 +00:00
SkyZeroZx
a0fe177682 docs(devtools): Removes comment about enum deprecation
Removes comment about enum deprecation
2025-10-30 19:40:07 +00:00
AleksanderBodurri
c963569c0e refactor(devtools): use getRouterInstance to replace manual parsing logic
Previously we would look in the DI tree for a token named 'Router' and resolve its value.

Now we use the already existing getRouterInstance, which depends on ng global debug APIs to get the router instance of an application.
2025-10-27 09:23:16 +01:00
AleksanderBodurri
ecfcaba3b1 feat(devtools): Use "App Root" as name for root of router tree.
Previously '/' could cause confusion with other routes that use a path here. I think because this node is unique in that it is not actually a "Route" we should make it clear with the label that is simply the App Root.
2025-10-27 09:22:33 +01:00
Matthieu Riegler
7ad02b9805 refactor(devtools): fix parameter matching. (#64260)
Adding some typing to infer the expected types and drop the usages of `arguments` which isn't really typesafe.

The argument mis-match didn't result in an issue because they didn't end up being used futher down the line.

fix 63973

PR Close #64260
2025-10-10 06:40:43 -07:00
AleksanderBodurri
32ed78bcbe fix(devtools): optimize object sanitization logic (#64234)
Previously this would take ~3500ms adev.

This updated logic avoids the constant JSON.stringify implementation and instead checks for serializable values directly.

After this change this code path for adev takes less than 20ms.

(Benchmarks taken on an M1 Macbook Pro)

PR Close #64234
2025-10-06 15:00:19 -04:00
Taygan Caldwell
6169fa5888 fix(devtools): stop second component tree traversal, if devtools metadata is placed on the body tag (#64161)
Stop multiple component tree traversals if the app root is the body tag. This caused the devtools ui to duplicate the component information, if the app root was the body tag

PR Close #64161
2025-10-02 07:46:56 -07:00
Matthieu Riegler
a10eb38f76 feat(devtools): Add possibility to log directive instances and their prop values (#64143)
The improves debug possibilties via the Angular devtools

fixes #62235

PR Close #64143
2025-09-30 10:30:58 -04:00
Alan Agius
fc643c9044 build: adopt moduleResolution: "bundler" (#64125)
This commit updates the TypeScript configuration across the project to use `moduleResolution: "bundler"`. This modernizes our module resolution strategy to align with current TypeScript best practices and bundler behaviors.

The following changes are included:
- Updated `tsconfig.json` files to set `moduleResolution` to `"bundler"`.
- Updated the `rules_angular` bazel dependency to a version compatible with these changes.
- Adjusted related test files and golden files to reflect the new module resolution strategy.

PR Close #64125
2025-09-29 14:20:23 -04:00
Matthieu Riegler
44d2ec5a05 refactor(devtools): guard value reads in the serializer (#64096)
Some properties (like gets) might throw when we try to read them.
With this commit we fail gracefuly and show a warning message for the property that can't be read.

fixes #56755

PR Close #64096
2025-09-29 13:08:11 -04:00
AleksanderBodurri
d006721f30 feat(devtools): clean up router tree for stable release (#63081)
Addresses some cleanup items for the router tree:

- No longer loads router ng global APIs as a side effect of importing the router. Rather this is now a runtime step that occurs when provideRouter is called.
- No longer depends on router.navigateByUrl in Angular DevTools. There is now a dedicated global util for this
- Router instance logic no longer depends on token name
- Prevents navigating to lazy or redirect routes (these don't have an associated component)

PR Close #63081
2025-09-02 20:59:15 -07:00
Hongxu Xu
1f4c5f72aa refactor(bazel): reduce build deps (#63348)
clean up deps in bazel build scripts

PR Close #63348
2025-08-28 09:16:10 -07:00
Joey Perrott
3df1dccebe refactor: various build and import specificer fixes for strict deps (#63323)
Change direct deps in bazel targets and import specifiers within files to maintain strict deps requirements ahead of enabling strict deps tests in the repo

PR Close #63323
2025-08-22 14:45:00 -07:00
Matthieu Riegler
c3c9a9eed3 refactor(devtools): fix renamed function. (#63268)
`getRoots` was renamed `getAppRoots` in a prior commit.

PR Close #63268
2025-08-20 09:24:43 +00:00
hawkgs
863401b858 refactor(devtools): add property show graph button (#62853)
Add "Show graph" button to the signal properties in the side pane only for Angular apps. This required storing the signal graph in a separate service.

PR Close #62853
2025-08-20 09:04:24 +00:00
AleksanderBodurri
5115050928 fix(devtools): DOM traversal bug (#62719)
Previously, Angular devtools would mistakenly traverse the same DOM elements multiple times while doing traversal for the component tree explorer. This error case would occur when more than 1 Angular application root component was present on the same page and in distinct DOM branches.

Some example cases that did work previously:

```html
<app-root>
...
</app-root>
```

```html
<app-root>
...
<app-root-2></app-root-2>
...
</app-root>
```

An example of where it would enter the irregular behaviour

```html
<app-root>
...
</app-root>
<app-root-2>
...
</app-root-2>
```

Now, we properly ignore duplicate DOM paths when looking for application and non-application root component to begin the Angular DevTools component discovery logic.

PR Close #62719
2025-08-18 15:43:09 +00:00
Matthieu Riegler
4b183c7708 refactor(devtools): add explicit error message when ng is not available (#63008)
This makes the error more explicit in the console.

PR Close #63008
2025-08-05 18:14:12 +02:00
Joey Perrott
cbc258eec8 build: remove ts_project_interop infrastructure (#62908)
Remove the interop macros and final usages

PR Close #62908
2025-07-31 09:12:58 +00:00
Hryhorii Avcharov
a2f366f629 feat(devtools): add transfer state tab (#62465)
Add transfer state tab, which is taking transfer state script by using APP_ID. Created internal api ɵgetTransferState to retrieve transfer state value from app into devtools app.

PR Close #62465
2025-07-22 08:41:10 -04:00
Milo
2e6c2ff52c refactor(devtools): disable view source button if source function is not available (#62678)
if there is no debuggableFn, we shouldn't allow users to click the view source button

PR Close #62678
2025-07-17 13:28:35 -04:00
Joey Perrott
5eeb9f3e7e build: move all rule/macro loading into devtools/defaults.bzl (#62627)
Move all of our loading into a local defaults.bzl file instead of mixed loading via tools/defaults and devtolls/defaults

PR Close #62627
2025-07-14 15:47:05 -07:00
Milo
1de7ab28b4 fix(devtools): fix some build errors from g3 typescript (#62412)
this avoids some issues with casting types

PR Close #62412
2025-07-11 10:35:22 -07:00
Matthieu Riegler
69531668bf refactor(devtools): remove unused imports (#62530)
Import had no purpose and was also invalid.

PR Close #62530
2025-07-08 12:12:22 -07:00
Matthieu Riegler
4f25a8a756 fix(devtools): do not emit a route object with functions (#62254)
In the case where a Route has title defined as a function, it eventually throw when it reaches `window.postMessage`

fixes #60595

PR Close #62254
2025-07-08 11:28:27 -07:00
Joey Perrott
85b3ae2e3e build: migrate devtools to use packaged version of @angular/* packages (#62413)
Use the packaged versions of the packages instead of the local ts_project dependencies to prevent multiple versions of the deps to enter test bundles

PR Close #62413
2025-07-02 16:10:25 +00:00
Matthieu Riegler
d283595bfa fix(devtools): sanitize route data. (#62339)
The serialization of route data does not support cyclic data objects. We sanitize nested route data object by replacing invalid values with a placeholder string.

PR Close #62339
2025-06-30 09:31:18 +00:00
Joey Perrott
b84859073b build: migrate to use web test runner rules (#62292)
Migrate karma tests throughout the repo to use the new web test runner based rule instead

PR Close #62292
2025-06-26 17:19:10 +00:00