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

Fix - Handle Routing Event - Don't Unmount If Navigation is Cancelled #190

Conversation

b-ferrari
Copy link
Contributor

@b-ferrari b-ferrari commented Jun 13, 2023

This PR addresses a bug brought up in Issue 151 and Issue 180. The bug is around the current app mounted on the screen disappearing when navigation is cancelled while using the single-spa-layout engine.

This issue can be reproduced in this forked repository by trying to navigate from application2 to application1.

The fix was to add a small logical check to the handleRoutingEvent function in the constructLayoutEngine file. Previously this function was always unmounting the application regardless of navigation state. This change only unmounts the application if navigation is not cancelled. If navigation is cancelled, the app currently mounted on the screen will remain mounted.

Here is a small gif demonstrating the fix while tracking the window events that the single-spa-layout engine subscribes to:
2023-06-13_10-39-58

Copy link
Member

@joeldenning joeldenning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, thanks

package.json Outdated Show resolved Hide resolved
@joeldenning joeldenning merged commit eef6b1b into single-spa:main Jun 15, 2023
@joeldenning
Copy link
Member

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

Successfully merging this pull request may close these issues.

2 participants