This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 219
WooExpress: Fix Checkout and Cart Blocks Editor Crash #11024
Merged
tarhi-saad
merged 1 commit into
trunk
from
fix/10885-wooexpress-cart-checkout-editor-crash
Sep 22, 2023
Merged
WooExpress: Fix Checkout and Cart Blocks Editor Crash #11024
tarhi-saad
merged 1 commit into
trunk
from
fix/10885-wooexpress-cart-checkout-editor-crash
Sep 22, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tarhi-saad
added
type: bug
The issue/PR concerns a confirmed bug.
block: cart
Issues related to the cart block.
block: checkout
Issues related to the checkout block.
labels
Sep 21, 2023
woocommercebot
requested review from
a team and
tarunvijwani
and removed request for
a team
September 21, 2023 23:53
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
🎉 🎉 This PR does not introduce new TS errors. |
Size Change: +23 B (0%) Total Size: 1.47 MB
ℹ️ View Unchanged
|
tarhi-saad
force-pushed
the
fix/10885-wooexpress-cart-checkout-editor-crash
branch
from
September 22, 2023 06:49
bda1254
to
4f231ff
Compare
opr
approved these changes
Sep 22, 2023
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.
Nice fix, seems to work well! Just wondering if we should check the Should be tested by the development team exclusively
box?
github-actions
bot
added
status: ready to merge
and removed
status: needs review
labels
Sep 22, 2023
tarhi-saad
force-pushed
the
fix/10885-wooexpress-cart-checkout-editor-crash
branch
from
September 22, 2023 17:35
4f231ff
to
70ad17a
Compare
tarhi-saad
deleted the
fix/10885-wooexpress-cart-checkout-editor-crash
branch
September 22, 2023 18:10
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
block: cart
Issues related to the cart block.
block: checkout
Issues related to the checkout block.
type: bug
The issue/PR concerns a confirmed bug.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
This PR resolves the editor crash issue on WooExpress sites when trying to delete the Cart or Checkout templates.
Fixes #10885
Why
If a block is removed, we shouldn't reinsert its inner blocks.
Jetpack performs a verification to ascertain if specific blocks are children of a premium-content parent block. The critical function can be seen here:
When deleting the Checkout (or Cart) Block, our block-locking feature attempts to reinsert an Inner Block (like
Gift Card Form
). However, its parent block (checkout-order-summary-block
) has already been removed from the DOM. Consequently, theparents
variable yields[ null ]
. This leads to theTypeError: Cannot read properties of null (reading 'name')
error when executing the linereturn !! parents.find( parent => parent.name.indexOf( 'premium-content/' ) === 0 );
. This error subsequently causes the Editor to crash.Testing Instructions
You'll need a WooExpress site. You can create one for free from here.
To upload and install this PR's Woo Blocks ZIP file, you can either upgrade your WooExpress site or use the CLI as described here: p1693928195787919/1693489673.470409-slack-C7U3Y3VMY
Ensure the block-locking feature is still working
Appearance -> Editor -> Templates -> Checkout
(or Cart)Edit
to access the template editorList View
and try to delete theGift Card Form
or theGift Card Totals
Blocks. UntickPrevent removal
under theUnlock
option:Gift Card Form
(orGift Card Totals
) Block isn't deleted (It's actually being reinserted each time we click onDelete)
)Test removing the Checkout (or Cart) Blocks in the Editor
Screenshots or screencast
N/A
WooCommerce Visibility
Required:
Checklist
Required:
[type]
label or a[skip-changelog]
label.Conditional:
[skip-changelog]
label is not present).Changelog