You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 to SKIP_BECAUSE_BROKEN because the parcels can only be unmounted if they are in the MOUNTED 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 the UNMOUNTING 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.
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 the MOUNTED state, and then it will unmount.
The text was updated successfully, but these errors were encountered:
@joeldenning I'm using single-spa-react, so I don't ever call parcel.unmount on my side manually. It gets unmounted because the parent react component gets unmounted, and then tries to unmount again in the same tick of the event loop when the route changes. I've put a bandaid in for now where I get a reference to the parcel and I poll the status until it is in the MOUNTED state. But its not a scalable fix - we will share many components cross-MFE, and we will run into this issue again and again. It seems like parcel should be able to handle if a call to unmount comes in while it is in the UNMOUNTING state
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: