Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Second navigation in same app is always ignored #529

Open
kentora opened this issue Oct 18, 2024 · 7 comments
Open

Second navigation in same app is always ignored #529

kentora opened this issue Oct 18, 2024 · 7 comments

Comments

@kentora
Copy link

kentora commented Oct 18, 2024

Demonstration

I have a single-spa setup with a nav-app, app1 and app2. When i click a link for app1 in my nav-app, and then another link for another component in app1 from nav-app the navigation is ignored. This happens consitently, and only for the second navigation.

It seems to be releated to #113 as i can see that upon mounting app1 the first time, replaceState in extra-provider.ts is called, setting the flag skipNextPopState, which then causes the second navigation event to be ignored.

I'm unsure if the fix is needed with newer versions of single-spa, or the root cause has been fixed. I have not had any problems in commenting out the line setting the flag.

Expected Behavior

Navigation occurs

Actual Behavior

Navigation is ignored.

@Arjun99
Copy link

Arjun99 commented Nov 16, 2024

Is this happening only for your app1 ? Have you setup emptyroutecomponent in your angular applications?

@kentora
Copy link
Author

kentora commented Nov 18, 2024

It seems to be pretty consistent, when navigation occurs within the active app. EmptyRouteComponent is correctly setup.

@Arjun99
Copy link

Arjun99 commented Nov 18, 2024

Can you share your layout.html in the root-config file that you have created for the configuring the routes.

@sandeep-dxc
Copy link

sandeep-dxc commented Nov 26, 2024

I have created a repo to reproduce this issue, thanks to @kfrederix for the base repo.

Screen.Recording.2024-11-26.210344.mp4

https://github.com/sandeep-dxc/single-spa-angular-esm

pnpm i
pnpm dev
http://localhost:4300/

@joeldenning @arturovt Would you have any suggestions on how to resolve this.

Thanks.

@Arjun99
Copy link

Arjun99 commented Nov 26, 2024

Hi Sandeep,

Let me check that and get back to you.

@kfrederix
Copy link

Hello @sandeep-dxc , I took a look at your repo => you can solve this issue by setting urlRerouteOnly to false in the host main.ts. E.g.

start({ urlRerouteOnly: false });

(I will add that also on my repo, because it's usually recommended to do that for Angular applications)

@sandeep-dxc
Copy link

Thanks @kfrederix, its working now 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants