Skip to content

Templates and Template part revision history shows wrong first revision #49164

@draganescu

Description

@draganescu

Description

When editing for the 1st time a template or template part and saving, the result of the edit is saved in the database. That becomes the 1st version of the post saved. This is erroneous because compared to the original version saved on disk, the 1st version saved in the database contains edits. This leads to a poor UX like the one described in #48610 where users think their edits have not been saved as a revision.

The templates and template parts are not in the database and the 1st time they're edited they're basically added to the database, along with their edit. This shows up as two revisions, one with an empty post and one with the post having all the content (including the 1st edit).

Starting only with the 2nd edit, which will result in 3 available revisions, will we see actual diffs.

Step-by-step reproduction instructions

  1. Start a fresh WordPress install with Gutenberg 15.2 installed and
  2. Open the Site Editor and open a template or template part to
  3. Add a paragraph with text to the template and save the changes.

You can check for template revisions immediately, or after closing and re-opening the Site Editor. But none will.

  1. Edit the template again and make a different change, like adding an image, and saving the changes.

After this edit - revisions will start showing.

props @jordesign

Screenshots, screen recording, code snippet

revisions-after-one-edit.mp4

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs Design FeedbackNeeds general design feedback.[Feature] HistoryHistory, undo, redo, revisions, autosave.[Feature] Templates APIRelated to API powering block template functionality in the Site Editor[Type] BugAn existing feature does not function as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions