Fix an afterModel check to avoid reloading the page when the queryParam gets updated (#2255)

This commit is contained in:
Carlos Alcaide Corvo authored and GitHub committed 2024-04-18 08:03:13 -07:00
1 parent f9cd1c331f
commit 298e804500
1 file changed
+14 -12
@@ -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;
}
}
/**