-
Notifications
You must be signed in to change notification settings - Fork 136
Description
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.
Steps to Reproduce the Problem
- Create post. Do nothing.
- Attempt to close the tab or leave the page.
- 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).
