Skip to content

Commit

Permalink
feat: add debugging for setting signer
Browse files Browse the repository at this point in the history
  • Loading branch information
simodrws committed May 11, 2023
1 parent 1d80b2a commit 4eadee8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 33 deletions.
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "@masa-finance/masa-react",
"version": "1.2.0-alpha.22",
"version": "1.2.0-alpha.23",
"license": "MIT",
"main": "./dist/src/index.js",
"typings": "./dist/src/index.d.ts",
Expand Down
21 changes: 1 addition & 20 deletions src/provider/hooks.ts
Expand Up @@ -46,25 +46,7 @@ export const invalidateAllQueries = async ({
signer,
walletAddress,
}: QueryKeyRetrievalInput) => {
console.log('invalidate all queries start');
const res = await Promise.all(
QUERIES.map((query: string) =>
queryClient.getQueriesData(
getQueryKeys()[query]({
masa,
signer,
walletAddress,
})
)
)
);

console.log(
'res inv queries',
res.map((r) => r[0])
);

const resTwo = await Promise.all(
await Promise.all(
QUERIES.map(async (query: string) =>
queryClient.invalidateQueries(
getQueryKeys()[query]({
Expand All @@ -75,7 +57,6 @@ export const invalidateAllQueries = async ({
)
)
);
console.log('res after invalidation', resTwo);
};

export const useLogout = (
Expand Down
4 changes: 1 addition & 3 deletions src/provider/modules/session/session.ts
Expand Up @@ -124,8 +124,6 @@ export const useSession = (
error,
} = useSessionQuery({ masa, walletAddress });

console.log('SESSION', { walletAddress, sessionData });

const { disconnectAsync } = useDisconnect();
const clearSession = useCallback(async () => {
await queryClient.invalidateQueries(['wallet']);
Expand All @@ -134,7 +132,7 @@ export const useSession = (

const handleLogout = useCallback(
async (logoutCallback?: () => void): Promise<void> => {
console.log('logging outtt!!');
console.log('logging outtt!! in session.ts');
if (!isLoggedIn) {
return;
}
Expand Down
14 changes: 5 additions & 9 deletions src/provider/use-account-state.ts
Expand Up @@ -106,20 +106,16 @@ export const useAccountState = ({
signer,
]);

console.log('renderaccountstate', {
wagmiAddress,
hasAccountAddress,
hasWalletAddress,
identity,
soulnames,
});
// * weird edge case
useAsync(async () => {
if (isDisconnected) {
await invalidateAllQueries({ masa, signer, walletAddress });
return;
}
if (isConnected) {
if (hasAccountAddress && hasWalletAddress) return;
if (wagmiAddress) setAccountAddress(wagmiAddress);
await invalidateAllQueries({ masa, signer, walletAddress });
console.log();
}
}, [
masa,
Expand Down Expand Up @@ -153,7 +149,7 @@ export const useAccountState = ({
reloadIdentity,
]);

console.log({
console.log('use-account-state', {
accountAddress,
signer,
isConnected,
Expand Down

0 comments on commit 4eadee8

Please sign in to comment.