Skip to content

Commit

Permalink
fix session proxy role downgrade cache inconsistency
Browse files Browse the repository at this point in the history
  • Loading branch information
brenzi committed Dec 13, 2024
1 parent 8816197 commit 651ed68
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions components/overlays/SessionProxiesOverlay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,9 @@ const modifySessionProxyRole = async (
" expiry update to: " +
expiry,
);
// clear the cached proxy entry at old role. it will be added again with the new role
// at the next fetchIncogniteeBalance
accountStore.removeProxyForRole(bestSessionProxyRole.value);
const nonce = new u32(
new TypeRegistry(),
accountStore.nonce[incogniteeSidechain.value],
Expand Down Expand Up @@ -360,6 +363,12 @@ watch(
isSignerBusy.value = false;
[bestSessionProxy.value, bestSessionProxyRole.value] =
accountStore.sessionProxyBest();
console.log(
"best session proxy: ",
bestSessionProxy.value.address,
" role: ",
bestSessionProxyRole.value,
);
if (bestSessionProxyRole.value !== null) {
selectedSessionProxyRole.value = bestSessionProxyRole.value;
} else {
Expand Down
4 changes: 4 additions & 0 deletions store/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@ export const useAccount = defineStore("account", {
this.sessionProxies[role] = sessionProxy;
this.sessionProxySeeds[sessionProxy] = seed;
},
removeProxyForRole(role: SessionProxyRole) {
delete this.sessionProxies[role];
delete this.sessionProxySeeds[role];
},
setBalanceFree(balance: BigInt, chain: ChainId) {
this.balanceFree[chain] = balance;
},
Expand Down

0 comments on commit 651ed68

Please sign in to comment.