-
Notifications
You must be signed in to change notification settings - Fork 45
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(carousel): avoid editor crash on empty #2058
Conversation
@@ -34,7 +34,7 @@ function newspack_blocks_render_block_carousel( $attributes ) { | |||
|
|||
$article_query = new WP_Query( Newspack_Blocks::build_articles_query( $attributes, apply_filters( 'newspack_blocks_block_name', 'newspack-blocks/carousel' ) ) ); | |||
if ( false === $article_query->have_posts() ) { | |||
return; | |||
return ''; |
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.
The docs said it return string, so I changed that to ''.
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.
Works well and avoids the crash!
Hey @naxoc, good job getting this PR merged! 🎉 Now, the Please check if this PR needs to be included in the "Upcoming Changes" and "Release Notes" doc. If it doesn't, simply remove the label. If it does, please add an entry to our shared document, with screenshots and testing instructions if applicable, then remove the label. Thank you! ❤️ |
# [4.7.0-alpha.1](v4.6.0...v4.7.0-alpha.1) (2025-02-20) ### Bug Fixes * **carousel:** avoid editor crash on empty ([#2058](#2058)) ([c316801](c316801)) * **modal-checkout:** better iframe sizing ([#2052](#2052)) ([aa308f2](aa308f2)) * **recaptcha:** use clone of #place_order button to trigger checkout ([#2028](#2028)) ([46eb8b5](46eb8b5)), closes [#2030](#2030) [#2030](#2030) ### Features * add styles to fix Braintree modal appearance ([#2036](#2036)) ([9ab2c62](9ab2c62)) * add toggle for transaction details ([#2049](#2049)) ([d254aca](d254aca)) * **carousel:** rename block and reorganise settings ([#1962](#1962)) ([9905717](9905717)) * update blocks with new brand ([#2050](#2050)) ([2711302](2711302))
🎉 This PR is included in version 4.7.0-alpha.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
All Submissions:
Changes proposed in this Pull Request:
This fixes a bug where the Content Carousel block would "crash" in the editor and just show a spinner and not be responsive to changes made from the sidebar.
How to test the changes in this Pull Request:
Before applying the patch, trigger the bug:
Now apply the patch:
Other information: