From 7d175edcec2bbb7d15fff2f76a6e9f5a20bcd369 Mon Sep 17 00:00:00 2001 From: pangratz Date: Tue, 2 Nov 2021 22:07:47 +0100 Subject: [PATCH] fix: ensure reloading an allocation doesn't result in an infinite loop `allocation.reload()` has differnt semantics for reloading, as it will reload the record in the background and immediately resolve [1]. By using the stores' findRecord and specifying `backgroundReload: false`, we make sure we await the response from the server and hereby have the complete record once we continue in the code. Using `allocation.reoad()` causes and infinite loop when we upgrade ember-data to 3.16 (and model fragments to 5.0.0-beta.2). [1] This is, unless `shouldBackgroundReload` on the adapter returns false, but it's true by default. --- ui/app/components/allocation-row.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/app/components/allocation-row.js b/ui/app/components/allocation-row.js index a92c618ad..4ef9a5680 100644 --- a/ui/app/components/allocation-row.js +++ b/ui/app/components/allocation-row.js @@ -86,7 +86,7 @@ async function qualifyAllocation() { // Make sure the allocation is a complete record and not a partial so we // can show information such as preemptions and rescheduled allocation. if (allocation.isPartial) { - await allocation.reload(); + await this.store.findRecord('allocation', allocation.id, { backgroundReload: false }); } if (allocation.get('job.isPending')) {