Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ui: Alter position of logic for showing the Round Trip Time tab to prevent DOM refresh #7377

Merged
merged 2 commits into from
Mar 4, 2020

Conversation

johncowen
Copy link
Contributor

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 to the partial, 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.

Fixes #7365

There is also another bug we found on our travels here, I decided to separate both PRs out, so theres another related one to follow.

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 to the partial, 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.
@johncowen johncowen added the theme/ui Anything related to the UI label Mar 3, 2020
@johncowen johncowen requested a review from a team March 3, 2020 16:52
@johncowen johncowen added backport/1.7 type/bug Feature does not function as expected labels Mar 3, 2020
Copy link
Contributor

@kaxcode kaxcode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ LGTM

@johncowen
Copy link
Contributor Author

Sorry @kaxcode , I had a re-think about this and decided to put the logic in the same template it originally was (which is also the same place we have the logic for showing the tab or not).

The other benefit is, my previous attempt would still show the {{tab-section}} component but it would be empty, so this second attempt is closer to the intent as it doesn't render the tab at all now.

@johncowen johncowen changed the title ui: Move tomography length check inside of the partial ui: Alter position of logic for showing the Round Trip Time tab to prevent DOM refresh Mar 4, 2020
@johncowen johncowen merged commit 468e82d into master Mar 4, 2020
@johncowen johncowen deleted the ui/bugfix/coordinate-refreshing branch March 4, 2020 18:12
@johncowen johncowen added this to the 1.7.2 milestone Mar 12, 2020
freddygv pushed a commit that referenced this pull request Mar 12, 2020
…event DOM refresh (#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.
alvin-huang pushed a commit to alvin-huang/consul that referenced this pull request May 6, 2020
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme/ui Anything related to the UI type/bug Feature does not function as expected
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refreshing issue in 1.7.0+ UI on node health checks page
2 participants