Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ui] Directly set MiddleTruncate truncated text to fix flicker (#26888)
## Summary & Motivation This is a small follow-up to #26834 I've noticed that sometimes with MiddleTruncate, there is a very slight flicker when the text is first rendered. There's a single frame where the rendered text is `null`, and you can see it before the text appears. I'm not sure if my computer is just running slow today (looking for excuses to get an M4 now...), or if it's the volume of MiddleTruncates on this page (there are at least 50 rendering all at the same time), but here's an example if you watch the tag on the right: https://github.com/user-attachments/assets/4a05049d-9e70-4aaf-883a-eb448a905b01 Looking at the code for this, I don't think there's a reason for the sizing to update React state and set the text through a React render. The text is just used to set the span content, and the component doesn't re-render unless the text changes (in which case `calculateTargetStyle` changes and the effect runs again.) Setting the textContent directly removes the flicker shown in the video. ## How I Tested These Changes Tested in FF + Chrome manually --------- Co-authored-by: bengotow <[email protected]>
- Loading branch information
194ba27
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.
Deploy preview for dagit-storybook ready!
✅ Preview
https://dagit-storybook-qly00ca0u-elementl.vercel.app
Built with commit 194ba27.
This pull request is being automatically deployed with vercel-action