-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Fix infinite render of inline block preview #47697
Conversation
Size Change: -11 B (0%) Total Size: 1.31 MB
ℹ️ View Unchanged
|
Flaky tests detected in 7b7050a. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4100516711
|
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.
This fixes the issue for me 👍
fffc193
to
7b7050a
Compare
import { __experimentalSpacer as Spacer } from '@wordpress/components'; | ||
|
||
const BlockPreviewPanel = ( { name, variation = '' } ) => { | ||
const [ |
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.
Hm.. why we needed useResizeObserver
in the first place here?
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.
To set the min-height of the preview iframe container, so that block preview (like button) is vertically center aligned.
It was captured using useResizeObserver
, but seems like it was a bad idea for non-floating scrollbars that change with and height when they appear on content overflow.
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.
LGTM 👍
✅ Image, Calendar, Latest Comments: Infinite loop doesn't occur
✅ Table: If viewportWidth
is defined with example, It will still be displayed as before.
✅ Button: It will be displayed in the center as before.
✅ Quote: If the block is less than the height of the preview area, the scroll bar will not be displayed as before.
ef06150b60678e27b950a381e07b4920.mp4
Cherry-picked this PR to the wp/6.2 branch. |
What?
This fixes #46793 where inline preview re-renders infinitely.
Issue happens for blocks such as
Testing Instructions
Issue happens when scrollbar is always visible.
Operating system settings:
Windows: scrollbar is visible by default.
Mac: System Preferences -> General -> show scrollbars (set the value to always)
Screenshots or screencast
Before
After