-
Notifications
You must be signed in to change notification settings - Fork 4.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
Fix sandbox refresh bug #20176
Fix sandbox refresh bug #20176
Conversation
…n order to fix bug with sandbox not refreshing when passed in html changes
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.
Confirmed the fix by programmatically updating the content attribute of an HTML block in preview mode.
Do you know if we can unit test this somehow.
Good question, will take a look. |
@youknowriad Took a while to get it rendering in a testable way - couldn't do it with mount or shallow, but act() from 'react-dom/test-utils' did the business, so a test committed using this - let me know if you know of a simpler way. |
The test is looking good for me. Thanks :) |
Regression: #20614 |
Description
Fixes #16831 - currently passing in new iframe html to the sandbox does not cause the component to rerender. This forces a rerender if the html prop has changed.
How has this been tested?
Tested manually using new google calendar block at Automattic/jetpack#13999 - without this patch, and with the temporary key prop to fix this issue removed updating the calendar embed url does not affect the iframe preview, with this patch the iframe preview is reloaded when embed url is changed
Types of changes
Sets the forceRerender value to false by default and sets to true if component updates and html prop has changed