Header: fix project update updates #43709
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It was recently observed that the header's
ScriptName
component -- which contains the script name and sometimes theProjectUpdatedAt
component below that which shows text like "Saved 2 hours ago" -- was being cropped at its right edge.While I wasn't able to get a firm local repro, I was able to simulate the suspected issue: the
ProjectUpdatedAt
component was having its content updated, but the parentScriptName
component didn't know that, so it didn't tell its parentHeaderMiddle
component about the newly-desired width.I'm not sure whether this was always an issue, or something new in a recent React update, but the fix is pretty simple: when the
ProjectUpdatedAt
component is updated, it informs its parentScriptName
, which then determines the width of the resulting content, and tells its parentHeaderMiddle
, which can go about reallocating space appropriately.The simulation of this issue simply put a timer inside
ProjectUpdatedAt
which rendered a random length string every second.Before, we can see that
HeaderMiddle
isn't reallocating space:header-projects-before-3.mov
After, we can see that
HeaderMiddle
reallocates spaces:header-projects-after-3.mov
This counts as a follow-up to #34551.