From ca6e7dfb88e503e2f76a3ffc0445abdc1c93e9b3 Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Thu, 31 Aug 2023 16:18:02 +0100 Subject: [PATCH] Added drop of intermediate post saves between current running and latest triggered (#17912) no issue - every triggered save was being added to a queue resulting in an unnecessary number of requests in some circumstances because it means every triggered save would be run sequentially even though the intermediate saves could be safely thrown away if we're still waiting on a response to a previous one - switched from a standard queue to ember-concurrency's `keepLatest` behaviour - drops intermediate saves if multiple saves are triggered whilst still waiting on a previous save - http://ember-concurrency.com/docs/task-concurrency#keepLatest --- ghost/admin/app/controllers/editor.js | 2 +- ghost/admin/app/controllers/lexical-editor.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ghost/admin/app/controllers/editor.js b/ghost/admin/app/controllers/editor.js index 91541b9dbc..b9c6800cad 100644 --- a/ghost/admin/app/controllers/editor.js +++ b/ghost/admin/app/controllers/editor.js @@ -149,7 +149,7 @@ export default class EditorController extends Controller { // cursor is in the slug field - that would previously trigger a simultaneous // slug update and save resulting in ember data errors and inconsistent save // results - @(taskGroup().enqueue()) + @(taskGroup().keepLatest()) saveTasks; @mapBy('post.tags', 'name') diff --git a/ghost/admin/app/controllers/lexical-editor.js b/ghost/admin/app/controllers/lexical-editor.js index 047ba9ece3..d2a67983b9 100644 --- a/ghost/admin/app/controllers/lexical-editor.js +++ b/ghost/admin/app/controllers/lexical-editor.js @@ -153,7 +153,7 @@ export default class LexicalEditorController extends Controller { // cursor is in the slug field - that would previously trigger a simultaneous // slug update and save resulting in ember data errors and inconsistent save // results - @(taskGroup().enqueue()) + @(taskGroup().keepLatest()) saveTasks; @mapBy('post.tags', 'name')