Skip to content

Commit

Permalink
ui: Alter position of logic for showing the Round Trip Time tab to pr…
Browse files Browse the repository at this point in the history
…event DOM refresh (hashicorp#7377)

* ui: Move tomography length check inside of the partial

Previously we checked the length of tomography.distances to decide
whether to show the RTT tab or not. Previous to our ember upgrade this
would not cause a DOM reload of so many elements (i.e. all of the tab
content). Since our ember upgrade, any change to tomography (so not
necessarily the length of distances) seems to fire a change to the length (even if
the length remains the same). The knock on effect of this is that the
array of tab panels seems to be recalculated (but remain the same) and
all of the tab panels are completely re-rendered, causing the scroll of
the page to be reset.

This commit moves the check for tomography.distance.length to the lower
down with the loop, which means the array of tab panels always remains
the same, which consequently means that the entire array of tab panels
is never re-rendered entirely, and therefore fixes the issue.
  • Loading branch information
johncowen authored and alvin-huang committed May 6, 2020
1 parent c12a62d commit a4ddd64
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ui-v2/app/templates/dc/nodes/show.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,11 @@
)
) key="id" as |panel|
}}
{{#if (or (not-eq panel.id 'round-trip-time') (gt tomography.distances.length 0)) }}
{{#tab-section id=panel.id selected=(eq (if selectedTab selectedTab '') panel.id) onchange=(action "change")}}
{{partial panel.partial}}
{{/tab-section}}
{{/if}}
{{/each}}
{{/block-slot}}
{{/app-view}}

0 comments on commit a4ddd64

Please sign in to comment.