From 033ec0ce1a7c96f4d62c7e803037fa13a94fd4e9 Mon Sep 17 00:00:00 2001 From: Abdullah Samman Date: Mon, 4 Jun 2018 11:46:49 +0300 Subject: [PATCH] Fixed broken loading state on transition between posts in editor (#1021) closes https://github.com/TryGhost/Ghost/issues/9582 - clear the `post` model on the `editor` controller when swapping models to avoid the editor contents and the editor loading state being displayed simultaneously --- ghost/admin/app/routes/editor/edit.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ghost/admin/app/routes/editor/edit.js b/ghost/admin/app/routes/editor/edit.js index 4bedc3f3e8..f39bfa88c3 100644 --- a/ghost/admin/app/routes/editor/edit.js +++ b/ghost/admin/app/routes/editor/edit.js @@ -1,6 +1,18 @@ import AuthenticatedRoute from 'ghost-admin/routes/authenticated'; export default AuthenticatedRoute.extend({ + beforeModel(transition) { + this._super(...arguments); + + // if the transition is not new->edit, reset the post on the controller + // so that the editor view is cleared before showing the loading state + if (transition.urlMethod !== 'replace') { + let editor = this.controllerFor('editor'); + editor.set('post', null); + editor.reset(); + } + }, + model(params) { let query = { id: params.post_id,