Make WordPress Core

Opened 18 months ago

Closed 15 months ago

Last modified 15 months ago

#46076 closed defect (bug) (reported-upstream)

Block editor preview not displaying unsaved changes to a post when meta boxes are active

Reported by: talldanwp Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Editor Keywords:
Focuses: Cc:


Originally created as a github issue, for background see here:

The cause of this is explained in this comment:

  1. A published post is previewed, generating an autosave.
  2. The POST request to save PHP meta boxes is sent to post.php. The published post is updated and its last-modified time is bumped.
  3. The POST request is redirected as a GET request to post.php again. This logic runs, which compares the modified dates of the autosave and the post: https://github.com/WordPress/wordpress-develop/blob/e5b5db9e2349dfe8a43ac42bea5738146f53994d/src/wp-admin/edit-form-blocks.php#L294-L303
  4. The modified date of the post is now more recent than the autosave, so the autosave is deleted.
  5. The preview loads, but there's no more autosave to preview.

To test:

  1. Create a new post using the block editor
  2. Open the options dialog and enable 'Custom Fields'
  3. Add a title, content and a custom field to the post and save it
  4. Add some further changes to the post content and click the preview button

Expected behaviour
Changes added in step 4 are displayed in the preview

Actual behaviour
None of the changes are visible in the preview

Attachments (1)

46076.diff (949 bytes) - added by pento 15 months ago.

Download all attachments as: .zip

Change History (9)

This ticket was mentioned in Slack in #core-editor by sheri. View the logs.

18 months ago

#2 @dlh
18 months ago

Related: #45768.

This ticket was mentioned in Slack in #core by benoitchantre. View the logs.

16 months ago

#4 @SergeyBiryukov
16 months ago

  • Component changed from General to Editor

#5 @noisysocks
16 months ago

  • Milestone changed from Awaiting Review to Future Release

15 months ago

#6 @pento
15 months ago

  • Milestone Future Release deleted
  • Resolution set to reported-upstream
  • Status changed from new to closed

Closing this, as it was ultimately fixed in GB11409.

The larger issue of supporting post meta revisions is tracked in #20564.

#7 @earnjam
15 months ago

I think you meant fixed in GB14877?

#8 @pento
15 months ago

Yep, thanks for noticing that, @earnjam!

Note: See TracTickets for help on using tickets.