Skip to content

Commit

Permalink
Merge pull request #344 from NoahSaso/noah/fix-iframe-again
Browse files Browse the repository at this point in the history
Fix iframe origin bug AGAIN
  • Loading branch information
pyramation authored Oct 6, 2023
2 parents d5c2d68 + 1d2af75 commit 77a54da
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions packages/react-lite/src/hooks/useIframe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,12 @@ export const useIframe = ({
// Broadcast keystore change event to iframe wallet.
useEffect(() => {
const notifyIframe = () => {
iframe?.contentWindow.postMessage({
event: IFRAME_KEYSTORECHANGE_EVENT,
});
iframe?.contentWindow.postMessage(
{
event: IFRAME_KEYSTORECHANGE_EVENT,
},
'*'
);
};

// Notify inner window of keystore change on any wallet client change
Expand Down Expand Up @@ -139,9 +142,12 @@ export const useIframe = ({

// Whenever wallet changes, broadcast keystore change event to iframe wallet.
useEffect(() => {
iframe?.contentWindow.postMessage({
event: IFRAME_KEYSTORECHANGE_EVENT,
});
iframe?.contentWindow.postMessage(
{
event: IFRAME_KEYSTORECHANGE_EVENT,
},
'*'
);
}, [wallet, iframe]);

useEffect(() => {
Expand Down

0 comments on commit 77a54da

Please sign in to comment.