From fc82980d6849e7a747d8cd3f48fd05eaf816afbd Mon Sep 17 00:00:00 2001 From: Zhihe Li Date: Mon, 10 Jun 2024 17:14:40 -0400 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20Fix=20active=20session=20?= =?UTF-8?q?display=20in=20targets=20table=20(#2321)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-13981 --- .../app/routes/scopes/scope/projects/targets/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) 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 6f362e388..e0a4d65b2 100644 --- a/ui/desktop/app/routes/scopes/scope/projects/targets/index.js +++ b/ui/desktop/app/routes/scopes/scope/projects/targets/index.js @@ -10,6 +10,7 @@ import { STATUS_SESSION_PENDING, } from 'api/models/session'; import { action } from '@ember/object'; +import { run } from '@ember/runloop'; export default class ScopesScopeProjectsTargetsIndexRoute extends Route { // =services @@ -72,6 +73,13 @@ export default class ScopesScopeProjectsTargetsIndexRoute extends Route { */ beforeModel() { if (!this.session.isAuthenticated) this.router.transitionTo('index'); + + // Unload all sessions from the store as we might have sessions still in store + // if they were canceled outside of the desktop client + // Not wrapping it an ember run seems to cause a test to fail as well as an error + // if you switch between orgs due to a similar issue as this + // https://github.com/emberjs/data/issues/5447#issuecomment-845672812 + run(() => this.store.unloadAll('session')); } /**