WordPress.org

Make WordPress Core

Opened 11 months ago

Closed 8 months ago

Last modified 8 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:
PR Number:

Description

Originally created as a github issue, for background see here:
https://github.com/WordPress/gutenberg/issues/12617

The cause of this is explained in this comment:
https://github.com/WordPress/gutenberg/issues/12617#issuecomment-452604656

  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 8 months ago.

Download all attachments as: .zip

Change History (9)

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


11 months ago

#2 @dlh
11 months ago

Related: #45768.

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


8 months ago

#4 @SergeyBiryukov
8 months ago

  • Component changed from General to Editor

#5 @noisysocks
8 months ago

  • Milestone changed from Awaiting Review to Future Release

@pento
8 months ago

#6 @pento
8 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
8 months ago

I think you meant fixed in GB14877?

#8 @pento
8 months ago

Yep, thanks for noticing that, @earnjam!

Note: See TracTickets for help on using tickets.