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

🐛 Fixed admin error when deleting an unsaved or imported post #20053

Conversation

cmraible
Copy link
Contributor

ref https://linear.app/tryghost/issue/ENG-845/error-attempted-to-set-lexical-on-the-deleted-record
ref https://linear.app/tryghost/issue/ENG-854/🐛-deleting-imported-posts-makes-ghost-unresponsive

  • When deleting a post in the editor's Post Settings Menu, if the post has unsaved changes (indicated by the hasDirtyAttributes property in the editor), Admin will crash because it tries to save a post revision before leaving the editor, but the post has already been deleted so saving fails.
  • This can occur when editing a post and quickly deleting it from the Post Settings Menu before saving is completed.
  • It can also occur when attempting to delete an imported post, as the editor will parse the lexical from the server and may make some minor, invisible-to-the-user changes to the lexical string locally (e.g. JSON formatting, or updating the JSON to use extended version of base lexical nodes), which triggers the same error.
  • This fix bypasses the attempt to save a post revision when leaving the editor if the post is already deleted, which allows the transition back to the Posts route to succeed.

@github-actions github-actions bot added the affects:admin Anything relating to Ghost Admin label Apr 18, 2024
@cmraible cmraible force-pushed the chris-eng-845-error-attempted-to-set-lexical-on-the-deleted-record branch from bab30e2 to 59ba95b Compare April 18, 2024 16:44
@cmraible cmraible merged commit a10b139 into main Apr 18, 2024
22 checks passed
@cmraible cmraible deleted the chris-eng-845-error-attempted-to-set-lexical-on-the-deleted-record branch April 18, 2024 17:02
cmraible added a commit that referenced this pull request Apr 18, 2024
ref
https://linear.app/tryghost/issue/ENG-845/error-attempted-to-set-lexical-on-the-deleted-record
ref
[https://linear.app/tryghost/issue/ENG-854/🐛-deleting-imported-posts-makes-ghost-unresponsive](https://linear.app/tryghost/issue/ENG-854/%F0%9F%90%9B-deleting-imported-posts-makes-ghost-unresponsive)

- When deleting a post in the editor's Post Settings Menu, if the post
has unsaved changes (indicated by the hasDirtyAttributes property in the
editor), Admin will crash because it tries to save a post revision
before leaving the editor, but the post has already been deleted so
saving fails.
- This can occur when editing a post and quickly deleting it from the
Post Settings Menu before saving is completed.
- It can also occur when attempting to delete an imported post, as the
editor will parse the lexical from the server and may make some minor,
invisible-to-the-user changes to the lexical string locally (e.g. JSON
formatting, or updating the JSON to use extended version of base lexical
nodes), which triggers the same error.
- This fix bypasses the attempt to save a post revision when leaving the
editor if the post is already deleted, which allows the transition back
to the Posts route to succeed.
cmraible added a commit to cmraible/Ghost that referenced this pull request Apr 25, 2024
…st#20053)

ref
https://linear.app/tryghost/issue/ENG-845/error-attempted-to-set-lexical-on-the-deleted-record
ref
[https://linear.app/tryghost/issue/ENG-854/🐛-deleting-imported-posts-makes-ghost-unresponsive](https://linear.app/tryghost/issue/ENG-854/%F0%9F%90%9B-deleting-imported-posts-makes-ghost-unresponsive)

- When deleting a post in the editor's Post Settings Menu, if the post
has unsaved changes (indicated by the hasDirtyAttributes property in the
editor), Admin will crash because it tries to save a post revision
before leaving the editor, but the post has already been deleted so
saving fails.
- This can occur when editing a post and quickly deleting it from the
Post Settings Menu before saving is completed.
- It can also occur when attempting to delete an imported post, as the
editor will parse the lexical from the server and may make some minor,
invisible-to-the-user changes to the lexical string locally (e.g. JSON
formatting, or updating the JSON to use extended version of base lexical
nodes), which triggers the same error.
- This fix bypasses the attempt to save a post revision when leaving the
editor if the post is already deleted, which allows the transition back
to the Posts route to succeed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects:admin Anything relating to Ghost Admin browser-tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant