UI error when deleting posts created via the ghost api

Issue Summary
When I delete a draft post that was created via the API, I am not taken back to the list of posts. Navigation is not possible on mobile. There is an error logged:
Uncaught Error: Attempted to set ‘lexical’ on the deleted record

  • What did you expect to happen?
    The post would be deleted and I am taken back to the main page.

Steps to Reproduce

Create a post using the API.
Go into ghost admin and attempt to delete the post.


Setup information

Ghost Version
Hosted @ ghost.org

Browser & OS version
I have gotten this error in Safari, edge, and chrome

Relevant log / error output

rsvp.js:434  Uncaught (in promise) e {name: 'TransitionAborted', message: 'TransitionAborted', stack: 'TransitionAborted: TransitionAborted\n    at _ (htt…dor-acb4be1026763a831f30d671dbf4320e.js:3234:605)'}
_ @ rsvp.js:434
(anonymous) @ rsvp.js:491
invoke @ backburner.js:272
flush @ backburner.js:188
flush @ backburner.js:342
_end @ backburner.js:770
B._boundAutorunEnd @ backburner.js:507
Promise.then (async)
n @ backburner.js:26
flush @ index.js:40
_scheduleAutorun @ backburner.js:936
_end @ backburner.js:776
B._boundAutorunEnd @ backburner.js:507
Promise.then (async)
n @ backburner.js:26
flush @ index.js:40
_scheduleAutorun @ backburner.js:936
_end @ backburner.js:776
B._boundAutorunEnd @ backburner.js:507
Promise.then (async)
n @ backburner.js:26
flush @ index.js:40
_scheduleAutorun @ backburner.js:936
_ensureInstance @ backburner.js:927
schedule @ backburner.js:626
(anonymous) @ rsvp.js:10
g @ rsvp.js:382
p @ rsvp.js:346
f @ rsvp.js:360
r @ rsvp.js:464
(anonymous) @ ajax-request.js:177
Promise.then (async)
(anonymous) @ ajax-request.js:174
(anonymous) @ rsvp.js:459
P @ rsvp.js:915
t @ promise.js:22
request @ ajax-request.js:173
ajax @ ajax-support.js:34
saveRecord @ embedded-relation-adapter.js:60
createRecord @ embedded-relation-adapter.js:45
(anonymous) @ -private.js:8064
_ @ rsvp.js:434
(anonymous) @ rsvp.js:491
invoke @ backburner.js:272
flush @ backburner.js:188
flush @ backburner.js:342
_end @ backburner.js:770
B._boundAutorunEnd @ backburner.js:507
Promise.then (async)
n @ backburner.js:26
flush @ index.js:40
_scheduleAutorun @ backburner.js:936
_ensureInstance @ backburner.js:927
schedule @ backburner.js:626
(anonymous) @ rsvp.js:10
g @ rsvp.js:382
p @ rsvp.js:346
f @ rsvp.js:360
r @ rsvp.js:464
(anonymous) @ ajax-request.js:177
Promise.then (async)
(anonymous) @ ajax-request.js:174
(anonymous) @ rsvp.js:459
P @ rsvp.js:915
t @ promise.js:22
request @ ajax-request.js:173
generateSlug @ slug-generator.js:33
generateSlugTask @ lexical-editor.js:737
step @ generator-state.js:28
generatorStep @ executor.js:243
handleResolvedContinueValue @ executor.js:123
proceedSync @ executor.js:87
start @ executor.js:39
start @ base.js:56
(anonymous) @ refresh.js:23
process @ refresh.js:23
refresh @ scheduler.js:47
invoke @ backburner.js:270
flush @ backburner.js:188
flush @ backburner.js:342
_end @ backburner.js:770
end @ backburner.js:573
_run @ backburner.js:814
_join @ backburner.js:791
join @ backburner.js:613
c @ index.js:157
(anonymous) @ has_element.js:24
e.flaggedInstrument @ index.js:126
handleEvent @ has_element.js:20
handleEvent @ view_support.js:331
(anonymous) @ event_dispatcher.js:293
dispatch @ jquery.js:5430
g.handle @ jquery.js:5234
helpers.ts:120  Uncaught Error: Attempted to set 'lexical' on the deleted record <post:65b6208ba4e0c20001083db8>
    at Ye.setDirtyAttribute (-private.js:4752:1)
    at e.set (-private.js:148:1)
    at Me._set (index.js:1776:1)
    at Me.set (index.js:1727:1)
    at e.r [as lexical] (index.js:878:1)
    at Oe (index.js:1327:1)
    at index.js:1357:1
    at Oe (index.js:1323:1)
    at we.set (observable.js:172:1)
    at we.beforeSaveTask (lexical-editor.js:544:1)
    at beforeSaveTask.next (<anonymous>)
    at e.GeneratorState.step (generator-state.js:28:1)
    at e.TaskInstanceExecutor.generatorStep (executor.js:243:1)
    at e.TaskInstanceExecutor.handleResolvedContinueValue (executor.js:123:1)
    at e.TaskInstanceExecutor.proceedSync (executor.js:87:1)
    at e.TaskInstanceExecutor.start (executor.js:39:1)
    at i.start (base.js:56:1)
    at refresh.js:23:1
    at Array.forEach (<anonymous>)
    at e.default.process (refresh.js:23:1)
    at r.refresh (scheduler.js:47:1)
    at r.perform (scheduler.js:39:1)
    at a._performShared (task.js:68:1)
    at a._perform (task.js:56:1)
    at we.saveTask (lexical-editor.js:467:1)
    at saveTask.next (<anonymous>)
    at e.GeneratorState.step (generator-state.js:28:1)
    at e.TaskInstanceExecutor.generatorStep (executor.js:243:1)
    at e.TaskInstanceExecutor.handleResolvedContinueValue (executor.js:123:1)
    at e.TaskInstanceExecutor.proceedSync (executor.js:87:1)
    at e.TaskInstanceExecutor.start (executor.js:39:1)
    at i.start (base.js:56:1)
    at refresh.js:23:1
    at Array.forEach (<anonymous>)
    at e.default.process (refresh.js:23:1)
    at r.refresh (scheduler.js:47:1)
    at r.perform (scheduler.js:39:1)
    at a._performShared (task.js:68:1)
    at a._perform (task.js:56:1)
    at we.autosaveTask (lexical-editor.js:408:1)
    at autosaveTask.next (<anonymous>)
    at e.GeneratorState.step (generator-state.js:28:1)
    at e.TaskInstanceExecutor.generatorStep (executor.js:243:1)
    at e.TaskInstanceExecutor.handleResolvedContinueValue (executor.js:123:1)
    at e.TaskInstanceExecutor.proceedSync (executor.js:87:1)
    at e.TaskInstanceExecutor.start (executor.js:39:1)
    at i.start (base.js:56:1)
    at refresh.js:23:1
    at Array.forEach (<anonymous>)
    at e.default.process (refresh.js:23:1)

I see the same sort of error when deleting posts and pages created by importing a JSON file as well and with posts uploaded via the API (perhaps the import uses the API?). For completeness, I write in Markdown on Obsidian and then upload using the API.

This behaviour is seen with a local copy of Ghost installed on Mac OS X, and on trial sites on DigitalPress and on MagicPages.

The UI locks up (via web browser on a computer), and the only way to get out of it is to reload the admin page. It then prompts whether I want to leave the site as unsaved changes will be lost.

Posts and pages created ‘interactively’ via the editor can be deleted without any issues, and control of the UI is not lost.