0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

🐛 Fixed hang in editor when back button is pressed whilst feature image caption is focused (#19367)

closes https://github.com/TryGhost/Product/issues/4228

- when leaving the editor via back button the feature image caption editor's blur handler was called by the React editor component after Ember had torn down the route resulting in an attempt to use `post.set()` when `post` doesn't exist
- the error also caused Lexical to re-render to try and recover which then triggered the blur handler again resulting in an infinite loop
- adding a check to ensure `this.post` exists was enough to fix the problem
This commit is contained in:
Kevin Ansfield 2023-12-13 17:25:00 +00:00 committed by GitHub
parent 69a8f71bd1
commit b74a611fbd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -415,7 +415,7 @@ export default class LexicalEditorController extends Controller {
@action
handleFeatureImageCaptionBlur() {
if (this.post.isDraft) {
if (this.post?.isDraft) {
this.autosaveTask.perform();
}
}