-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Tiled Gallery: Add noResize to block save #29496
Conversation
The block save method should not depend on the browser. It should not create ResizeObservers and should be completely deterministic. This helps ensure that the block can be saved and parsed consistently so that it is not invalidated by the parser.
I'm not in love with Ideally, we'd like to separate out structural layout (React rendering) from any resizing logic necessary in JavaScript. |
if ( width && width !== this.state.width ) { | ||
this.setWidth( width ); | ||
handleResize = this.props.noResize | ||
? () => {} |
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.
I take that this ternary is just an optimization because we already have if ( ! this.props.noResize )
in componentDidMount
?
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.
At this point, it's redundant as you note. I expect we may start to call resize on mount to get initial sizes set up. This is also complete, noResize
really will not resize.
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.
Tests well 👍
A good step towards possibly removing style
attributes from saved HTML.
…sh-2019 * origin/master: change "expert" to "support" in page route and title (#29459) Add note to concierge upsell page about sessions only being offered in English. (#29461) Jetpack Blocks: Fix webpack warnings due to dynamic import (#29509) Gutenberg: Reset core resolvers on site change (#29445) Signup: Remove Masterbar from Signup (#28886) Fix missing bumpStat call (#29504) Gutenberg Jetpack Preset: Generate imports dynamically from index.json (#29435) Fix the clean:public script to do a better job cleaning public/ folder (#29354) Tiled gallery: Add alignWide support (#29493) Tiled Gallery: Add noResize to block save (#29496) Show G Suite user fields by default (#29458) ColorThemes: Add GA and bumpStat events for scheme picking (#29413) Remove legacy mock for extensions reducer (#29397) Antispam promo card: tweak copy to make it clearer (#29440) prevent 0 as street number for ebanx checkouts (#29487) Gutenberg: Update Related Posts to use the posts endpoint (#29439) remove override on payment methods name in India (#29406) Add a space to separate "the" from the holiday name placeholder. (#29479) Revert "Migrate my-sites/sharing to webpack css pipeline (#28607)" (#29463) Gutenpack Subscription Block (Take two) (#28887)
The block save method should not depend on the browser. It should not
create ResizeObservers and should be completely deterministic.
This helps ensure that the block can be saved and parsed consistently so
that it is not invalidated by the parser.
Bite sized PR from #29465
Testing