This demonstration showcases the issue:
Replacing this.observeLoading$
with of(false)
resolves the problem, indicating that it may be related to the fact that this.observeLoading$
receives notifications from a ReplaySubject
that can provide multiple notifications...
Below are more specific details:
Firstly, this section resolves successfully:
async resolve(
route: ActivatedRouteSnapshot) {
const topic = await of(false).pipe(
switchMap((v) =>{
console.log("MADE IT THIS FAR: ", v)
return of(new Topic)
})).toPromise()
console.log("THE TOPIC RETURNED IS", topic)
return topic;
In the above example, all logs are printed and navigation is completed.
In the following situation, it prints "MADE IT THIS FAR: false", but then stops:
async resolve(
route: ActivatedRouteSnapshot) {
const id = route.paramMap.get('id')
const topic = await this.cs.loadingTopicStore$.pipe(
switchMap((v) =>{
console.log("MADE IT THIS FAR: ", v)
return of(new Topic)
})).toPromise()
console.log("THE TOPIC RETURNED IS", topic)
return topic;
Both scenarios appear to be similar. The only distinction lies in using of(false)
in the first case and using this.cs.loadingTopicStore$
in the second case, with both cases logging "MADE IT THIS FAR:".
Any insights?