2
1
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2023-12-13 21:00:40 +01:00

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
This commit is contained in:
Kevin Ansfield 2023-09-01 14:35:59 +01:00 committed by GitHub
parent a4f6a33fee
commit d67a7bdc58
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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'