Skip to content

fix(devtools): duplicated props in the properties panel#66712

Merged
AndrewKushnir merged 1 commit intoangular:mainfrom
hawkgs:devtools/fix-duplicated-properties
Feb 9, 2026
Merged

fix(devtools): duplicated props in the properties panel#66712
AndrewKushnir merged 1 commit intoangular:mainfrom
hawkgs:devtools/fix-duplicated-properties

Conversation

@hawkgs
Copy link
Copy Markdown
Member

@hawkgs hawkgs commented Jan 22, 2026

This fixes the issue mentioned in this PR comment.

Bug & Steps To Reproduce

In essence, sometimes* the children of a property in the Properties panel are duplicated. Often, this happens for a brief moment, making the issue a bit hard to catch and diagnose. Here are some steps to reproduce (one example) in the demo app without having to modify the existing code:

  1. Open the demo app.
  2. Quickly select app-sample-properties.
  3. Quickly expand the first prop – computedObject – in the Properties panel. This should happen before app-heavy is loaded.
  4. Until app-heavy is loaded, the nested properties will be duplicated.

Obviously, there are minimal reproducible examples, but they require significant modifications to the app.

Culprit

After an extensive investigation, it appears that the culprit is the diff function which is in charge of finding the difference between and modifying the existing FlatNode tree by a provided new one in the property data source. Here is the exact mechanism of the bug:

  1. The top-level properties of a specific component are loaded.
  2. A consecutive automatic call is loading the first level of nested properties.
  3. Respectively, the new FlatNode tree is fed to the diff function along with the existing tree without nested props.
  4. Since the tree is represented as an array in the data source, for example:
{
  x: {
    x1: {
      x2: ...
    }
  },
  y: { y1 }
}

is [x, x1, x2, y, y2] where each property contains the level of nesting, all nodes except the first one are affected by the update (e.g. new nodes and moved nodes), meaning that in the given example only x remains unchanged.
5. However, x technically keeps (should keep) a reference to its children that is used to determine whether its children are loaded.
6. If the user expands x, the program determines that x doesn't have its nested properties loaded based on the reference.
7. This results in another nested props request that technically leads to the duplication of these props.

Fix

diff now performs an additional identity check and updates the items that haven't been moved or changed in any other way but their reference (respectively, internals).

Also, there are some unit tests to cover for the core diff operations.

@AleksanderBodurri, I think it's best that you review the PR since the code probably dates back to the very first versions of the DevTools. It seems that the bug is quite old.


* While the culprit of the bug was found and it's evident that the affected nodes are the ones which internals were changed but retained their position in the array (usually, first nodes in the array), I haven't delved into why the properties resolve or stabilize by themselves, so to speak. I assume it has to do with component tree updates triggering some sort of a refresh.

Fix the diff algorithm that consequentially caused the duplicated props.
@atscott atscott added this to the Backlog milestone Jan 26, 2026
@hawkgs hawkgs added action: merge The PR is ready for merge by the caretaker target: minor This PR is targeted for the next minor release labels Feb 9, 2026
@AndrewKushnir AndrewKushnir merged commit c4abadb into angular:main Feb 9, 2026
23 checks passed
@AndrewKushnir
Copy link
Copy Markdown
Contributor

This PR was merged into the repository. The changes were merged into the following branches:

@hawkgs hawkgs deleted the devtools/fix-duplicated-properties branch February 9, 2026 16:58
@angular-automatic-lock-bot
Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Mar 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: devtools target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants