From d67a7bdc58f7f2be7ef8e9cf605e7a25f4c6e064 Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Fri, 1 Sep 2023 14:35:59 +0100 Subject: [PATCH] Fixed console error when leaving new post screen with beta editor (#17928) no issue - when a post is new it has no revisions but in the `willTransition` hook we were using `lastRevision.get` even though `lastRevision` was null - adjusted the `hasChangedSinceLastRevision` conditional to always be `false` for new posts --- 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 d2a67983b9..3e5fcf7120 100644 --- a/ghost/admin/app/controllers/lexical-editor.js +++ b/ghost/admin/app/controllers/lexical-editor.js @@ -954,7 +954,7 @@ export default class LexicalEditorController extends Controller { // Check if anything has changed since the last revision let postRevisions = post.get('postRevisions').toArray(); let latestRevision = postRevisions[postRevisions.length - 1]; - let hasChangedSinceLastRevision = post.get('lexical') !== latestRevision.get('lexical'); + let hasChangedSinceLastRevision = !post.isNew && post.lexical !== latestRevision.lexical; let fromNewToEdit = this.router.currentRouteName === 'lexical-editor.new' && transition.targetName === 'lexical-editor.edit'