Fix - Handle Routing Event - Don't Unmount If Navigation is Cancelled #190
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 theconstructLayoutEngine
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: