Skip to content

Commit

Permalink
Merge branch 'develop' into jl/mmp-1033/preferences-controller-networ…
Browse files Browse the repository at this point in the history
…k-meta
  • Loading branch information
jiexi committed Sep 21, 2023
2 parents d9a9103 + 48184fe commit f6a8325
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -3203,7 +3203,7 @@ export default class MetamaskController extends EventEmitter {
}

_startUISync() {
// Message startUISync is used in MV3 to start syncing state with UI
// Message startUISync is used to start syncing state with UI
// Sending this message after login is completed helps to ensure that incomplete state without
// account details are not flushed to UI.
this.emit('startUISync');
Expand Down
8 changes: 7 additions & 1 deletion app/scripts/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,13 @@ async function start() {
extensionPort.onMessage.addListener(messageListener);
extensionPort.onDisconnect.addListener(resetExtensionStreamAndListeners);
} else {
initializeUiWithTab(activeTab);
const messageListener = async (message) => {
if (message?.data?.method === 'startUISync') {
initializeUiWithTab(activeTab);
extensionPort.onMessage.removeListener(messageListener);
}
};
extensionPort.onMessage.addListener(messageListener);
}

function initializeUiWithTab(tab) {
Expand Down

0 comments on commit f6a8325

Please sign in to comment.