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

Wait until content loaded before calculating font size. #3052

Merged
merged 2 commits into from
Aug 20, 2019

Conversation

miina
Copy link
Contributor

@miina miina commented Aug 20, 2019

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 for anonymous font-size was applied later than the real font size.

This PR checks if the author block's content is loaded before calculation.

@miina miina requested a review from swissspidy August 20, 2019 08:58
@googlebot googlebot added the cla: yes Signed the Google CLA label Aug 20, 2019
}

const anonymousUserName = __( 'Anonymous', 'amp' );
return anonymousUserName.toLowerCase() !== blockContent.toLowerCase();
Copy link
Contributor Author

@miina miina Aug 20, 2019

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?

Copy link
Collaborator

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.

Copy link
Contributor Author

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. 🤦‍♀

@miina
Copy link
Contributor Author

miina commented Aug 20, 2019

@swissspidy Would you mind reviewing again to get it to 1.2.1?

Copy link
Collaborator

@swissspidy swissspidy left a comment

Choose a reason for hiding this comment

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

Works well

@swissspidy swissspidy merged commit 8be6ab6 into develop Aug 20, 2019
@swissspidy swissspidy deleted the fix/3047-font_size_changing branch August 20, 2019 17:20
@westonruter westonruter added this to the v1.2.1 milestone Aug 20, 2019
westonruter added a commit that referenced this pull request Aug 22, 2019
* 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.
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Signed the Google CLA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Font size changing after refresh
4 participants