1

So I am working on a project and after routing was implemented a component has broken. On one component I have used a promise delay to hold off some DOM manipulation (adding a class to an element) while an animation occurs. Both of these work fine. The problem happens when I enter setTimeout via a promise, code below

function delay(ms: number) {
 return new Promise((resolve) => setTimeout(resolve, ms));
}

Fairly standard. When I remove the promise the component works fine but setTimeout never executes and with the promise it never resolves of course which halts execution for that component completely.

When I run the app without routing, ie just the app without the app shell there is no issue. setTimeout executes as expected. So I am inclined to believe the issue is somewhere in the routing.

This is the project layout enter image description here

I am relatively new to angular and I did not do the routing personally but we have to proceed. My understanding after research is a more typical app-shell setup would be this

https://stackblitz.com/edit/angular-ivy-dy4ant?file=src%2Fapp%2Fshell%2Fshell.component.ts

If anyone has guidance I would be greatly appreciate it as I'm stabbing around in the dark mostly here.

1
  • please replicate the issue on the stackblitz and update that the stackblitz has this issue, which need to be fixed. Its unclear what the actual problem is! Commented May 15, 2024 at 15:14

1 Answer 1

0

Someone was running a constant loop of clearTimeout in a component which cause the timeout to never execute

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.