From ff9d3056dbf32e8b905276f455b072584cdc702b Mon Sep 17 00:00:00 2001 From: Alana Luyten Date: Mon, 13 Jan 2025 17:26:50 +0100 Subject: [PATCH] fix(distribution): redirect to first inquiry after fetching navigation data --- packages/distribution/addon/routes/index.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/distribution/addon/routes/index.js b/packages/distribution/addon/routes/index.js index 3d673805a1..baadba3143 100644 --- a/packages/distribution/addon/routes/index.js +++ b/packages/distribution/addon/routes/index.js @@ -1,4 +1,5 @@ import Route from "@ember/routing/route"; +import { scheduleOnce } from "@ember/runloop"; import { inject as service } from "@ember/service"; export default class IndexRoute extends Route { @@ -6,10 +7,7 @@ export default class IndexRoute extends Route { @service distribution; @service router; - async redirect() { - // trigger resource - this.distribution.navigation.value; - + async redirectToFirstInquiry() { // wait for navigation request and group resolver await this.distribution.fetchNavigation.last; await this.scheduler.resolveGroup.last; @@ -25,4 +23,8 @@ export default class IndexRoute extends Route { }); } } + + afterModel() { + scheduleOnce("afterRender", this, "redirectToFirstInquiry"); + } }