Fix: forget account for legacy account without authorizedAccounts (#1381)

* fix: forget account for legacy account without authorizedAccounts

* fix: comment
This commit is contained in:
Thibaut Sardan
2024-06-28 16:43:24 +02:00
committed by GitHub
parent 4bf6f9f016
commit 0a52b5d046
@@ -121,11 +121,11 @@ export default class Extension {
// cycle through authUrls and prepare the array of diff
Object.entries(this.#state.authUrls).forEach(([url, urlInfo]) => {
if (!urlInfo.authorizedAccounts.includes(address)) {
return;
// Note that urlInfo.authorizedAccounts may be undefined if this website entry
// was created before the "account authorization per website" functionality was introduced
if (urlInfo.authorizedAccounts?.includes(address)) {
authorizedAccountsDiff.push([url, urlInfo.authorizedAccounts.filter((previousAddress) => previousAddress !== address)]);
}
authorizedAccountsDiff.push([url, urlInfo.authorizedAccounts.filter((previousAddress) => previousAddress !== address)]);
});
this.#state.updateAuthorizedAccounts(authorizedAccountsDiff);