single-spa / single-spa-vue

a single-spa plugin for vue.js applications
MIT License
182 stars 42 forks source link

Check parcel status before calling unmount #95

Open af-tomwilkins opened 2 years ago

af-tomwilkins commented 2 years ago

I have been running into the following error using the Parcel component: image

This occurs when the parent application unmounts. Looking at the lib, there's no check on the parcel status before calling unmount.

My change is the equivalent of this line in single-spa-react: https://github.com/single-spa/single-spa-react/blob/main/src/parcel.js#L66

Ensuring that unmount is only ever called on parcels with a status of MOUNTED.

I would be grateful if someone more familiar with the project could please review this, hoping it's suitable to merge!

J1mmyC01 commented 2 years ago

Would be great to get this PR reviewed. Many thanks.

joeldenning commented 2 years ago

I pulled down your code to add tests to it, but was unable to reproduce the problem in tests. Could you please provide a demonstration of the repo? Before merging this PR, we need to understand the root cause and have tests for it.

af-tomwilkins commented 2 years ago

@joeldenning Thanks for looking at this. The component using the parcels is in a private repository on Bitbucket and uses an in-house parcel implementation we created to tide us over, but I've published a version using single-spa-vue to GitHub and invited you to collaborate.

Instructions to see the problem are on the README of the repository.

joeldenning commented 1 year ago

I don't know which repository you invited me to view. Adding a test to the single-spa-vue repository would be the best approach for demonstrating that there was a problem and that there no longer is.