From 298e80450099a5c42f1a9c1ffd726788f78ba5c3 Mon Sep 17 00:00:00 2001 From: Carlos Alcaide Corvo Date: Thu, 18 Apr 2024 08:03:13 -0700 Subject: [PATCH] Fix an afterModel check to avoid reloading the page when the queryParam gets updated (#2255) --- .../scopes/scope/storage-buckets/new.js | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/ui/admin/app/routes/scopes/scope/storage-buckets/new.js b/ui/admin/app/routes/scopes/scope/storage-buckets/new.js index 39edd73c1..c744a15fc 100644 --- a/ui/admin/app/routes/scopes/scope/storage-buckets/new.js +++ b/ui/admin/app/routes/scopes/scope/storage-buckets/new.js @@ -83,18 +83,20 @@ export default class ScopesScopeStorageBucketsNewRoute extends Route { } async afterModel() { - let scopes; - const orgScopes = ( - await this.store.query('scope', { - scope_id: 'global', - query: { filters: { scope_id: [{ equals: 'global' }] } }, - }) - ).map((scope) => ({ model: scope })); - scopes = [ - { model: this.store.peekRecord('scope', 'global') }, - ...orgScopes, - ]; - this.scopes = scopes; + if (!this.scopes) { + let scopes; + const orgScopes = ( + await this.store.query('scope', { + scope_id: 'global', + query: { filters: { scope_id: [{ equals: 'global' }] } }, + }) + ).map((scope) => ({ model: scope })); + scopes = [ + { model: this.store.peekRecord('scope', 'global') }, + ...orgScopes, + ]; + this.scopes = scopes; + } } /**