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
|
mikachan
left a comment
There was a problem hiding this comment.
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.
Hm.. why we needed useResizeObserver in the first place here?
There was a problem hiding this comment.
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.
t-hamano
left a comment
There was a problem hiding this comment.
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