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: avoid throwing errors if container is no longer in page #424

Merged
merged 8 commits into from
Apr 24, 2023
11 changes: 10 additions & 1 deletion src/parent/parent.js
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,16 @@ export function parentComponent<P, X, C>({
return clean.all(err);
})
.then(() => {
initPromise.asyncReject(err || new Error("Component destroyed"));
const error = err || new Error("Component destroyed");
if (
isElementClosed(currentContainer) ||
error.message === "Window navigated away"
oscarleonnogales marked this conversation as resolved.
Show resolved Hide resolved
) {
console.warn(error);
oscarleonnogales marked this conversation as resolved.
Show resolved Hide resolved
initPromise.resolve();
} else {
initPromise.asyncReject(error);
}
});
};

Expand Down