Skip to content
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

Fix #1184 #1189

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Fix #1184 #1189

wants to merge 1 commit into from

Conversation

BeastlyUnsold
Copy link

@BeastlyUnsold
Copy link
Author

G'day team, I'm keen to get a code review on this. I reckon it's something that ought to be sorted by the single-spa library, maybe right here or over in single-spa-react/parcel. I've set up a repo showing the fix in action, took a leaf out of the book from this pattern to make the change. Just holler if there's anything else needed on my end.

@BeastlyUnsold
Copy link
Author

@joeldenning, what's your take on this solution?

@BeastlyUnsold
Copy link
Author

@MilanKovacic , what's your take on this solution?

@MilanKovacic
Copy link
Collaborator

Hi, thank you for submitting the pull request. I will take a look.

@MilanKovacic MilanKovacic self-requested a review February 9, 2024 01:28
Copy link
Member

@joeldenning joeldenning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code change looks reasonable, I've left a couple comments.

Are you someone who I've asked not to contact me @BeastlyUnsold? I ask because issue #1184 was created by an Adobe employee, and I have been harassed by a dev at adobe who works on single-spa stuff. Your Github account was created recently and only has worked on this Adobe issue, which is enough for me to wonder whether I'm being alted by someone I've asked to never contact me again. I am cautious about it because he hasn't been able to stop interacting with me despite repeated requests and even legal action.

parcelConfig.unmount = () => {
parcelConfig.unmountCalls++;
return new Promise((r) => {
setTimeout(r, 2000);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why wait 2 seconds to resolve the promise?

});
// In some cases it is possible for a parcel to be in an unmounting status when `unmountThisParcel` is called a second time.
// https://github.com/single-spa/single-spa/issues/1184
if (parcel.status === UNMOUNTING && !!parcel.internalUnmountPromise) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Truthiness check is good enough for this if statement, no?

Suggested change
if (parcel.status === UNMOUNTING && !!parcel.internalUnmountPromise) {
if (parcel.status === UNMOUNTING && parcel.internalUnmountPromise) {

})
.then((value) => {
resolveUnmount(value);
return value;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deleting the internalMountPromise might be helpful for garbage collection.

Suggested change
return value;
delete this.internalMountPromise;
return value;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants