-
Notifications
You must be signed in to change notification settings - Fork 384
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
Wait until content loaded before calculating font size. #3052
Conversation
} | ||
|
||
const anonymousUserName = __( 'Anonymous', 'amp' ); | ||
return anonymousUserName.toLowerCase() !== blockContent.toLowerCase(); |
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.
Not sure if this might cause issues in some cases (or not work), perhaps there's a better way to check if the content has loaded. Thoughts?
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.
That seems a bit overly complicated.
Why not just return an isLoading
prop or so in the withSelect
part further down?
The component itself shouldn't be concerned with deciding that.
I suppose isLoading
could mean either getEditedPostAttribute()
or getAuthors()
is returning undefined
.
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.
Yep, that makes 100x more sense. 🤦♀
@swissspidy Would you mind reviewing again to get it to 1.2.1? |
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.
Works well
* tag '1.2.1': (434 commits) Bump 1.2.1 Adjust block inserter style. (#3075) Update dependency eslint-plugin-jest to v22.15.2 Fix flaky CTA test (#3057) Add more resizing handles (#3023) Bump version to 1.2.1-RC1 Improve story page background media with image srcset, reduced image size, and a11y text (#3006) Wait until content loaded before calculating font size. (#3052) Harden logic for normalizing image metadata before adding story images (#3049) Update dependency uuid to v3.3.3 (#3046) Inline color support (#3033) Update dependency webpack-cli to v3.3.7 (#3040) Tiny prop-types fix Update dependency babel-jest to v24.9.0 (#3037) Update e2e test setup (#3031) Include amp-script among dynamic_element_selectors in tree shaking Another try to fix tests. Ensure selecting the first page before removing the block. Move setting input selection to the end to helpers. Fix editor test. ...
Fixes #3047
Waits until the author block's content is loaded before calculating the font size.
Looks like the content switched quickly from
Anonymous
to the actual username, resulting in updating block attributes so that the update foranonymous
font-size was applied later than the real font size.This PR checks if the author block's content is loaded before calculation.