-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Description
Related: #7130
Currently, the post editor prompts when unsaved changes exist based on the withChangeDetection
higher-order reducer operating on state.editor
, which includes both edits (fields like title, etc) and block manipulations. This has the downsides of: (a) needing to reset change detection when it's inferred to have been persisted (on save) and (b) manually considering the presence of edited fields after a save to re-trigger dirtiness (#7130 (comment)).
Instead, change detection is only needed on block details. The isEditedPostDirty
should consider any fields in edits
as being unsaved. This requires that "initial edits" (described in #7130 (comment)) be refactored as a separate state value, and that blocks state be reshaped to allow withChangeDetection
to be applied to it specifically (via blocks.byUID
and blocks.order
by combineReducers
). This itself has proven challenging to implement since combineReducers
is not directly compatible with withChangeDetection
, since the latter adds a property isDirty
that causes warnings to occur by combineReducers
expected shape.