🐛 Fixed slug saving in editor (#16007)

refs TryGhost/Team#2294
- If user enter the slug name and then leave the post page, we should
wait until the slug would be saved on backend. The problem can be
reproduced with slow internet connection.
This commit is contained in:
Elena Baidakova 2022-12-14 19:39:01 +04:00 committed by GitHub
parent 270f288c48
commit 00c2b71502
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 0 deletions

View File

@ -788,6 +788,14 @@ export default class EditorController extends Controller {
this._koenig.cleanup();
}
// user can enter the slug name and then leave the post page,
// in such case we should wait until the slug would be saved on backend
if (this.updateSlugTask.isRunning) {
transition.abort();
await this.updateSlugTask.last;
return transition.retry();
}
let hasDirtyAttributes = this.hasDirtyAttributes;
let state = post.getProperties('isDeleted', 'isSaving', 'hasDirtyAttributes', 'isNew');

View File

@ -791,6 +791,14 @@ export default class LexicalEditorController extends Controller {
// this._koenig.cleanup();
// }
// user can enter the slug name and then leave the post page,
// in such case we should wait until the slug would be saved on backend
if (this.updateSlugTask.isRunning) {
transition.abort();
await this.updateSlugTask.last;
return transition.retry();
}
let hasDirtyAttributes = this.hasDirtyAttributes;
let state = post.getProperties('isDeleted', 'isSaving', 'hasDirtyAttributes', 'isNew');