Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editor: Consider option to unset edit from state #12334

Closed
aduth opened this issue Nov 26, 2018 · 2 comments
Closed

Editor: Consider option to unset edit from state #12334

aduth opened this issue Nov 26, 2018 · 2 comments
Labels
[Package] Editor /packages/editor [Type] Enhancement A suggestion for improvement.

Comments

@aduth
Copy link
Member

aduth commented Nov 26, 2018

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 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.

@paaljoachim
Copy link
Contributor

paaljoachim commented Jan 12, 2021

Is this issue still relevant?
As Andrew is away...
Greg @gziolo ?

@youknowriad
Copy link
Contributor

I'd say that It hasn't proved to be something that's really needed over time, so leet's just close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Editor /packages/editor [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

3 participants