From 507d83d5ed191e4e98bcc2f9ab8f8d4bcf4ea1f7 Mon Sep 17 00:00:00 2001 From: Matthieu Riegler Date: Sun, 17 Mar 2024 15:57:05 +0100 Subject: [PATCH] refactor(devtools): hide hydration error when the component tree is collapsed (#54912) This commit improves the devtools UX. PR Close #54912 --- .../directive-forest.component.html | 60 ++++++++++--------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/devtools/projects/ng-devtools/src/lib/devtools-tabs/directive-explorer/directive-forest/directive-forest.component.html b/devtools/projects/ng-devtools/src/lib/devtools-tabs/directive-explorer/directive-forest/directive-forest.component.html index 39e3e162ae99f..dee01c775974e 100644 --- a/devtools/projects/ng-devtools/src/lib/devtools-tabs/directive-explorer/directive-forest/directive-forest.component.html +++ b/devtools/projects/ng-devtools/src/lib/devtools-tabs/directive-explorer/directive-forest/directive-forest.component.html @@ -37,39 +37,41 @@ } {{ node.name }} - @if (node.directives) { - [{{ node.directives }}] - } - @if (isSelected(node)) { - == $ng0 - } - - @switch(node.hydration?.status) { - @case('hydrated') { - water_drop + @if (node.directives) { + [{{ node.directives }}] } - @case('skipped') { - invert_colors_off + @if (isSelected(node)) { + == $ng0 } - @case('mismatched') { - error_outline - } - } - - @if(node.hydration?.status === 'mismatched' && (node.hydration.expectedNodeDetails || node.hydration.actualNodeDetails)) { -
- @if(node.hydration.expectedNodeDetails) { -
Expected Dom:
-
{{node.hydration.expectedNodeDetails}}
- } - @if(node.hydration.actualNodeDetails) { -
Actual Dom:
-
{{node.hydration.actualNodeDetails}}
+ + @switch (node.hydration?.status) { + @case ('hydrated') { + water_drop + } + @case ('skipped') { + invert_colors_off + } + @case ('mismatched') { + error_outline + } }
- } + @if ( + treeControl.isExpanded(node) && + node.hydration?.status === 'mismatched' && + (node.hydration.expectedNodeDetails || node.hydration.actualNodeDetails) + ) { +
+ @if (node.hydration.expectedNodeDetails) { +
Expected Dom:
+
{{node.hydration.expectedNodeDetails}}
+ } + @if (node.hydration.actualNodeDetails) { +
Actual Dom:
+
{{node.hydration.actualNodeDetails}}
+ } +
+ } - -