Skip to content

Commit

Permalink
fix(initChild): setName is applied in popup context (#444)
Browse files Browse the repository at this point in the history
* fix(setName): for cross domain

* fix(setName): condition

* chore(refactor): initChild

* chore(refactor): initChild
  • Loading branch information
mnicpt committed Nov 2, 2023
1 parent 80b94f9 commit b26b8cb
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/parent/parent.js
Original file line number Diff line number Diff line change
Expand Up @@ -713,9 +713,18 @@ export function parentComponent<P, X, C>({
return ZalgoPromise.try(() => {
currentChildDomain = childDomain;
childComponent = childExports;
currentProxyWin?.setName(childExports?.name);
resolveInitPromise();
clean.register(() => childExports.close.fireAndForget().catch(noop));

currentProxyWin
?.isPopup()
.then((isPopup) => {
if (childExports?.name !== "" && isPopup) {
currentProxyWin?.setName(childExports?.name);
}
})
.finally(() => {
resolveInitPromise();
clean.register(() => childExports.close.fireAndForget().catch(noop));
});
});
};

Expand Down

0 comments on commit b26b8cb

Please sign in to comment.