Skip to content

Leave site? Alert too aggressive when EditFlow and Custom Statuses is enabled. #690

@jomurgel

Description

@jomurgel

Expected/Desired Behavior

Fill with either one:

The value of getPostEdits (wp.data.select('core/editor').getPostEdits()) would be empty until post save or unless the EditFlow status dropdown has changed.

Actual Behavior

After creating a new post, because of how the code changing the custom status https://github.com/Automattic/Edit-Flow/blob/2e07a1b7b7af1e783b858700390da85b418c2405/blocks/src/custom-status/block.js#L20-L42 is subscribed we immediately have a post edit (wp.data.select( 'core' ).getEntityRecordNonTransientEdits('postType', POST_TYPE, POST_ID )) which means that even if no changes were made when trying to leave the post or close the tab we are met with the "Leave site? Changes you made may not be saved." which is very confusing for editors.

image

Steps to Reproduce the Problem

  1. Create post. Do nothing.
  2. Attempt to close the tab or leave the page.
  3. Confirm that the "Leave site?" alert is present.

(Optional) Additional notes

The solution may be to, if nothing has changed in the dropdown, add the default in PHP on post save (rest_pre_insert_${post_type} or on the save_post hook).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions