-
Notifications
You must be signed in to change notification settings - Fork 219
Conversation
This is because by the time we reach this line, innerBlocks will be an empty array (or we wouldn't make it this far) and if nextBlocks contains ANY items it will, by definition be unequal, so a length check is simpler and more performant. Also we can remove the dependence on yet another lodash function by doing it this way.
…om/woocommerce/woocommerce-blocks into fix/stylebook-filter-preview
The release ZIP for this PR is accessible via:
Script Dependencies ReportThere is no changed script dependency between this branch and trunk. This comment was automatically generated by the TypeScript Errors Report
assets/js/blocks/cart-checkout-shared/use-forced-layout.ts
|
Size Change: +66 B (0%) Total Size: 1.09 MB
ℹ️ View Unchanged
|
Thanks for working on this @gigitux ! I see the PR was moved back to draft, but sharing my insights as I worked through this issue last week:
IMO hiding the notice is not the solution for this problem, as we are still rendering the older version of these blocks on Stylebook. In other words, the preview displayed in the editor currently differs from what is displayed on Stylebook. I've explored many different avenues for solving this last week. Still, I couldn't find a path that wouldn't involve a bigger change, or even a refactor of these blocks given the way they are currently structured: I was curious about what would be your approach/thoughts on this as the Porter this week: looks like we are converging to the same conclusions regarding the need of a bigger change. |
Hi @nefeline, thanks for your great feedback! I will explain what I discovered, I will use the I noticed that the Style Book previews the We have two options:
Also, I noticed another issue. At the current stage, some blocks are ready to use the example property in the block.json , while others no. So, for example, the filter blocks (except for the Filter Attribute) fetch the WP Rest API to get the data. Theoretically, the blocks in “preview mode” should use the attributes in the examples property. Rewrite the logic to use the attributes in the example property could require some time. Should we do this in this first iteration or should we postpone this? |
I think that the right approach is to show the preview of the cc @Aljullu |
Since that #8309 has been merged, I'm going to close this PR. |
This PR fixes the filter blocks preview on Stylebook. The error was caused by the filter wrapper and the logic to render the notice. It isn't necessary to render the notice when the
isPreview
attribute is set to true.All the filter blocks have the
isPreview
attribute, except for the Price Filter block. This PR fixes this too.Fixes #8175
Screenshots
Testing
Automated Tests
User Facing Testing
Filter Attributes
,Filter Price
andFilter Stock
blocks preview don't have any noticeWooCommerce Visibility
Performance Impact
Changelog