From a7d9a7e348cbf13a20922396b43321285f8d0fb6 Mon Sep 17 00:00:00 2001 From: Lisbet Alvarez <107949262+lisbet-alvarez@users.noreply.github.com> Date: Wed, 7 Aug 2024 10:38:38 -0700 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20targets=20not=20displayin?= =?UTF-8?q?g=20even=20after=20they=20are=20cached=20(#2429)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 🐛 targets not displaying even after they are cached * fix: 🐛 modify check in sessions route --- ui/desktop/app/routes/scopes/scope/projects/sessions/index.js | 4 ++-- ui/desktop/app/routes/scopes/scope/projects/targets/index.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ui/desktop/app/routes/scopes/scope/projects/sessions/index.js b/ui/desktop/app/routes/scopes/scope/projects/sessions/index.js index 23d089aec..4653a36c7 100644 --- a/ui/desktop/app/routes/scopes/scope/projects/sessions/index.js +++ b/ui/desktop/app/routes/scopes/scope/projects/sessions/index.js @@ -105,10 +105,10 @@ export default class ScopesScopeProjectsSessionsIndexRoute extends Route { const totalItems = sessions.meta?.totalItems; // Query all sessions and all targets for defining filtering values if entering route for the first time - if (!this.allSessions) { + if (!this.allSessions?.length) { await this.getAllSessions(orgScope, scopes, orgFilter); } - if (!this.allTargets) { + if (!this.allTargets?.length) { await this.getAllTargets(orgScope, orgFilter); } diff --git a/ui/desktop/app/routes/scopes/scope/projects/targets/index.js b/ui/desktop/app/routes/scopes/scope/projects/targets/index.js index 8b1993137..a6a70ed76 100644 --- a/ui/desktop/app/routes/scopes/scope/projects/targets/index.js +++ b/ui/desktop/app/routes/scopes/scope/projects/targets/index.js @@ -100,7 +100,7 @@ export default class ScopesScopeProjectsTargetsIndexRoute extends Route { scope_id: 'global', force_refresh: true, }); - const allTargetsPromise = !this.allTargets + const allTargetsPromise = !this.allTargets?.length ? this.makeAllTargetsQuery(orgScope, orgFilter) : Promise.resolve(); @@ -126,7 +126,7 @@ export default class ScopesScopeProjectsTargetsIndexRoute extends Route { ); const allTargets = await allTargetsPromise; - if (!this.allTargets) { + if (!this.allTargets?.length) { // Filter out targets to which users do not have the connect ability this.allTargets = allTargets.filter((target) => target.authorized_actions.includes('authorize-session'),