-
-
Notifications
You must be signed in to change notification settings - Fork 916
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
If an action tries to unmount a parcel while its already unmounting, the parent application gets set to SKIP_BECAUSE_BROKEN #1184
Comments
I don't think a change to single-spa is necessary here, since if (parcel.getStatus() === "MOUNTED") {
parcel.unmount();
} I'm open to discussing changing the related internal single-spa logic, but don't see why it's necessary |
@joeldenning I'm using single-spa-react, so I don't ever call |
Hi @bkfarnsworth, sorry for the late reply. We were/are working on internal improvements. I will take a look at the issue. |
Hi single-spa team, I'm happy to work on a PR for this issue if it is indeed a bug or an enhancement, and you can give me some pointers. Thanks!
Describe the bug or question
If some action tries to unmount parcels that are already in the
UNMOUNTING
state, the parent application will be set toSKIP_BECAUSE_BROKEN
because the parcels can only be unmounted if they are in theMOUNTED
state. The use case we have that triggers this is this: We mount some parcel components inside of a popover. When clicking submit in the popover, the popover unmounts, it sets the parcels to theUNMOUNTING
state, but then in the same frame we also change the url to navigate somewhere, so it tries again to unmount the parcels again, and it fails. We can work around this by putting the url change in a setTimeout, but we are going to be using these parcels in a lot of similar places, so we'd like to find a scalable solution.I've recorded a screen recording that walks through the issue in more detail, and shows lines of single-spa code that I think we could change to fix the issue: https://drive.google.com/file/d/1i-777GteMgk7aT2IeUcjy4-J682iDA_p/view?usp=sharing
Expected behavior
If a parcel is already unmounting, and another unmount request comes in, it latches on to the original unmount request. Maybe we should also consider other states, like
UPDATING
ie single-spa can just wait for the component to be back in theMOUNTED
state, and then it will unmount.The text was updated successfully, but these errors were encountered: