-
Notifications
You must be signed in to change notification settings - Fork 14k
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
fix: native filter truncation rerendering loop on hover #20021
fix: native filter truncation rerendering loop on hover #20021
Conversation
Codecov Report
@@ Coverage Diff @@
## master #20021 +/- ##
==========================================
- Coverage 66.28% 66.28% -0.01%
==========================================
Files 1712 1712
Lines 63968 63985 +17
Branches 6731 6734 +3
==========================================
+ Hits 42404 42414 +10
- Misses 19853 19860 +7
Partials 1711 1711
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
/testenv up |
@yousoph Ephemeral environment spinning up at http://34.219.158.185:8080. Credentials are |
Thanks for looking into this @diegomedina248 ! I ran into this a few times when testing something unrelated, and wondered if I did something weird that caused it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome fix and even better explanation! LGTM
Ephemeral environment shutdown and build artifacts deleted. |
🏷️ preset:2022.19 |
(cherry picked from commit cede148)
SUMMARY
This error was detected on a particular dashboard, for a particular set of conditions and only in chrome.
The truncation, in this case, refers to the right content of the
SCOPE
row.The
useTruncate
function computes the truncated elements by trying to fit one element at a time in the with of their container.Problem is, by using this information to truncate the element, and add the
+X
next to it, we're changing the container size, thus triggering another pass at this function.This, in 99.9% of the cases is fine, but, in very subtle conditions, it can change the truncated count back and forth, if:
+X
removes the space needed by the last visible element by 1+(X - 1)
tag makes enough room for the removed element to appear again.In this dashboard, the change was between +10 and +11, which has a very different pixel difference, but enough to cause the re-rendering loop.
This PR ensures we only compute the truncated elements if their size changes, or if the size of the parent of the container changes.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
For the reasons specified above, and given that the dashboard has private data, no gif is available.
Suffice to say, no change should be visible, the popup and truncation should remain the same for every other use case.
TESTING INSTRUCTIONS
Ensure that the native filters popup content displays correctly, and that the truncation still works as expected.
ADDITIONAL INFORMATION