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 accountsChanged notification #1413

Merged
merged 3 commits into from
Mar 10, 2020
Merged

Fix accountsChanged notification #1413

merged 3 commits into from
Mar 10, 2020

Conversation

rekmarks
Copy link
Member

@rekmarks rekmarks commented Mar 10, 2020

  • Use json-rpc-engine notifications to trigger accountsChanged events on the inpage provider
    • This currently causes console errors in the dapps, but doesn't actually break anything
    • Removing those errors is probably not straightforward

Fixes #1404

@rekmarks rekmarks self-assigned this Mar 10, 2020
@rekmarks rekmarks marked this pull request as ready for review March 10, 2020 19:16
@@ -864,6 +882,27 @@ export class BrowserTab extends PureComponent {
this.loadUrl();
}
}

const numApprovedHosts = Object.keys(approvedHosts).length;
const prevNumApprovedHosts = Object.keys(prevApprovedHosts).length;
Copy link
Contributor

Choose a reason for hiding this comment

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

approvedHosts and prevApprovedHosts are always defined?

Copy link
Member Author

@rekmarks rekmarks Mar 10, 2020

Choose a reason for hiding this comment

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

Yeah, approvedHosts is set in the privacy reducer. Its initial state is {}, and the clear action resets it to that.

@ibrahimtaveras00 ibrahimtaveras00 added the needs-qa Any New Features that needs a full manual QA prior to being added to a release. label Mar 10, 2020
const networkType = Engine.context.NetworkController.state.provider.type;
const chainId = Object.keys(NetworkList).indexOf(networkType) > -1 && NetworkList[networkType].chainId;
const result = {
isUnlocked,
isEnabled,
selectedAddress: isReady ? selectedAddress.toLowerCase() : null,
Copy link
Contributor

Choose a reason for hiding this comment

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

this wasn't necessary?

Copy link
Member Author

Choose a reason for hiding this comment

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

It was previously, but no longer. The changes I made match what we did on the extension, and we removed isEnabled and selectedAddress from the public config store.

Copy link
Member Author

Choose a reason for hiding this comment

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

I should have already removed both tbh, but overlooked it.

Copy link
Contributor

@ibrahimtaveras00 ibrahimtaveras00 left a comment

Choose a reason for hiding this comment

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

Fix looks good, QA passed 👍

Copy link
Contributor

@estebanmino estebanmino left a comment

Choose a reason for hiding this comment

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

👌 ship it

@rekmarks rekmarks merged commit bcb8d26 into develop Mar 10, 2020
@rekmarks rekmarks deleted the accountsChanged-fix branch March 10, 2020 21:33
rickycodes pushed a commit that referenced this pull request Jan 31, 2022
* use rpc-engine notifications for accountsChanged

* only notify current web page

Co-authored-by: Esteban Miño <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-qa Any New Features that needs a full manual QA prior to being added to a release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Changing accounts not detected unless reloading page on browser
3 participants