single-spa / single-spa-react

Single-spa lifecycles helper for React applications
https://single-spa.js.org/docs/ecosystem-react.html
MIT License
227 stars 63 forks source link

Nested parcels gets unmounted multiple times and throws #164

Open tretne opened 1 year ago

tretne commented 1 year ago

Hi!

I'm having a scenario where parcel A is mounted as <Parcel config={() => System.import('@parcelA')} /> in the main app and that parcel in turn mounts parcel B as <Parcel config={() => System.import('@parcelB')} />.

When parcel A then gets unmounted, parcel B will be unmounted twice. Once by componentWillUnmount in the Parcel component of parcel A here and once as the child of parcel A here.

One of these times parcel B already has the status "UNMOUNTING" here and will cause the error https://single-spa.js.org/error/?code=6&arg=&arg=UNMOUNTING to be thrown. Parcel A also will end up with status "SKIP_BECAUSE_BROKEN" and still be kept as a child parcel by the main app.

Using:

boringContributor commented 1 year ago

How do you use the Parcel component in react v5 ? This seems not even to work anymore

MilanKovacic commented 11 months ago

How do you use the Parcel component in react v5 ? This seems not even to work anymore

There was an error in one of the published versions. It should be fixed now.

sandeeppatel344 commented 1 week ago

Hi!

I'm having a scenario where parcel A is mounted as <Parcel config={() => System.import('@parcelA')} /> in the main app and that parcel in turn mounts parcel B as <Parcel config={() => System.import('@parcelB')} />.

When parcel A then gets unmounted, parcel B will be unmounted twice. Once by componentWillUnmount in the Parcel component of parcel A here and once as the child of parcel A here.

One of these times parcel B already has the status "UNMOUNTING" here and will cause the error https://single-spa.js.org/error/?code=6&arg=&arg=UNMOUNTING to be thrown. Parcel A also will end up with status "SKIP_BECAUSE_BROKEN" and still be kept as a child parcel by the main app.

Using:

  • single-spa v5.9.4
  • single-spa-react v5.0.0

I am also facing same issue. How we can solve?