You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, once a developer calls to editPost, there is no way for them to subsequently "unset" the edit, except by calling updatePost, which has a semantically distinct meaning in the sense of considering the value as the post's canonical saved value. A use case for unsetting an edit may not necessarily be in tandem with updating the post's saved value.
Consider then as an enhancement some option for unsetting an edit.
Some options include:
Passing undefined as a value for editPost should unset property
editPost( { someKey: undefined } );
Passing the currentPost (saved) value for editPost should unset property
editPost( { someKey: 'saved-value' } );
A new action creator dedicated to unsetting edits
uneditPost( 'someKey' );
A solution should also account for the fact that some edited properties are "merged" (e.g. meta). A nested merged property could result in the removal of the top-level key if its unsetting would result in there being no other keys of the merged edit. For example, given edits: { meta: { a: 1 } }, calling editPost( { meta: { a: undefined } } ) should not only unset a, but also the top-level meta key.
My preference would be toward one or both of the first two options.
The text was updated successfully, but these errors were encountered:
Raised by @youknowriad at: #12331 (comment)
Currently, once a developer calls to
editPost
, there is no way for them to subsequently "unset" the edit, except by callingupdatePost
, which has a semantically distinct meaning in the sense of considering the value as the post's canonical saved value. A use case for unsetting an edit may not necessarily be in tandem with updating the post's saved value.Consider then as an enhancement some option for unsetting an edit.
Some options include:
undefined
as a value foreditPost
should unset propertyeditPost( { someKey: undefined } );
currentPost
(saved) value foreditPost
should unset propertyeditPost( { someKey: 'saved-value' } );
uneditPost( 'someKey' );
A solution should also account for the fact that some edited properties are "merged" (e.g. meta). A nested merged property could result in the removal of the top-level key if its unsetting would result in there being no other keys of the merged edit. For example, given
edits: { meta: { a: 1 } }
, callingeditPost( { meta: { a: undefined } } )
should not only unseta
, but also the top-levelmeta
key.My preference would be toward one or both of the first two options.
The text was updated successfully, but these errors were encountered: