From af05799e1213093d3ca152fb7fb5da0e0135cd27 Mon Sep 17 00:00:00 2001 From: Dharini Jeeva Date: Mon, 21 Aug 2023 14:17:44 -0700 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20proxy=20promise=20depreca?= =?UTF-8?q?tion=20(#1851)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 🐛 proxy promise deprecation --- .../routes/scopes/scope/roles/role/index.js | 22 ++++++++++++------- yarn.lock | 2 +- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/ui/admin/app/routes/scopes/scope/roles/role/index.js b/ui/admin/app/routes/scopes/scope/roles/role/index.js index 8b39b2808..4d64d1d8b 100644 --- a/ui/admin/app/routes/scopes/scope/roles/role/index.js +++ b/ui/admin/app/routes/scopes/scope/roles/role/index.js @@ -17,14 +17,20 @@ export default class ScopesScopeRolesRoleIndexRoute extends Route { */ async afterModel() { const currentScope = this.modelFor('scopes.scope'); - const subScopes = currentScope.isProject - ? [] - : (await this.store.query('scope', { scope_id: currentScope.id })).map( - (scope) => ({ - model: scope, - subScopes: this.store.query('scope', { scope_id: scope.id }), - }) - ); + const scopes = await this.store.query('scope', { + scope_id: currentScope.id, + }); + let subScopes = []; + //await the store query to fix ember's proxy promise deprecation warning + if (!currentScope.isProject) { + subScopes = await Promise.all( + scopes.map(async (scope) => ({ + model: scope, + subScopes: await this.store.query('scope', { scope_id: scope.id }), + })) + ); + } + const grantScopes = [ { model: currentScope, diff --git a/yarn.lock b/yarn.lock index 4a0f0a253..03e4e4272 100644 --- a/yarn.lock +++ b/yarn.lock @@ -18913,7 +18913,7 @@ react-dom@^16: prop-types "^15.6.2" scheduler "^0.19.1" -react-is@^16.13.1: +react-is@^16.13.1, react-is@^16.8.1: version "16.13.1" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==