From b74a611fbd3c119c2c07214738f40d5fc4c5a688 Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Wed, 13 Dec 2023 17:25:00 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fixed=20hang=20in=20editor=20whe?= =?UTF-8?q?n=20back=20button=20is=20pressed=20whilst=20feature=20image=20c?= =?UTF-8?q?aption=20is=20focused=20(#19367)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- ghost/admin/app/controllers/lexical-editor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ghost/admin/app/controllers/lexical-editor.js b/ghost/admin/app/controllers/lexical-editor.js index a233e409e6..57740474be 100644 --- a/ghost/admin/app/controllers/lexical-editor.js +++ b/ghost/admin/app/controllers/lexical-editor.js @@ -415,7 +415,7 @@ export default class LexicalEditorController extends Controller { @action handleFeatureImageCaptionBlur() { - if (this.post.isDraft) { + if (this.post?.isDraft) { this.autosaveTask.perform(); } }