Repository navigation
fix(editor): show save errors and update nested or preview-less blocks after a save - #212
Merged
erseco merged 3 commits intoNov 27, 2026
Conversation
Contributor
Test in WordPress PlaygroundTest the plugin with the code from this branch:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## hotfix/editor-preview-fallback-in-canvas-iframe #212 +/- ##
==================================================================================
Coverage 96.79% 96.80%
Complexity 843 843
==================================================================================
Files 37 37
Lines 4334 4344 +10
==================================================================================
+ Hits 4195 4205 +10
Misses 139 139
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
- A non-JSON error page (413, 502) shows the status instead of a parser error. - An export error reported by the editor iframe is shown too. - The error overlay hides its Saving title and message, and a pending hide no longer takes it away. - The fallback text reuses the translated "Failed to save the file." string.
…otfix/editor-save-feedback-and-nested-blocks
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Stacked on #209 (same file); merge after #204 and #209. Four long-standing bugs in what the editor modal does after a save, found while reviewing #209.
A failed save showed nothing
The catch in
handleExportFile()callssetSavingState( false ), which removesis-visiblefrom the overlay, and thenshowLoadingError(), which only addedis-error. The overlay isvisibility: hiddenwithoutis-visible, so the message (e.g. "File too large") was written into a hidden element and the editor just stayed open.showLoadingError()now makes the overlay visible; its Close button already hides it.A successful save could be reported as failed
updateBlockPreview()only checkedwp.data. On a screen where another script loadswp-datawithout the block editor (Media Library, classic screens),select( 'core/block-editor' )is undefined and.getBlocks()threw inside the savetry: the file was stored, but noWP_SAVE_CONFIRMEDwas sent and the modal never closed. It now returns when the block editor store is missing.Blocks inside a Group or Columns kept their old preview
getBlocks()returns the top level only, so a nested eXeLearning block was never updated and the post was not saved with the new URL. The walk now descends intoinnerBlocks.A package that gained a preview kept "No preview available"
Only
previewUrlwas updated, while the block renders the iframe whenhasPreviewis also true. The save response carries a preview URL only when the package has one (build_save_response()), so the block now gets{ previewUrl, hasPreview: true }.Tests
npm run test:js: 275 passed.Review follow-up
Making the error visible exposed what it said:
response.json()and showed the parser's message; it now falls back to the save-failed text with the status.WP_REQUEST_SAVE_ERROR(the export failing inside the editor iframe) only logged to the console; it now shows the error too.close()is cancelled when an error is shown.npm run test:js: 277 passed;make test: OK.Not changed:
updateBlockPreview()still callssavePost()after updating a block, which also publishes any unsaved edits of the post. That predates this PR and looks intentional, but it now applies to nested blocks as well.