-
Notifications
You must be signed in to change notification settings - Fork 17
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
feat: redirect logged users to /home #640
Conversation
</script> | ||
|
||
<template> | ||
<div> | ||
<div v-if="!authInitiated || web3.authLoading" class="p-4"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why we want to show a loader here 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To not flash the landing page.
Else, it will show the landing page, while we're connecting the user async
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should have some localstorage variable (add value when user connects and delete if the user logout)
if user have this value, we should always redirect to /home
, else show /
Then we wait for user wallet connection on /home
, if user fails to connect his wallet, we should delete localstorage variable and redirect back to /
(also we should not try to auto-connect if user doesn't have this localstorage value, this may solve #478)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the issue is that we can not differentiate if the user is ready to be logged or if Metamask / user wallet is locked, this cause an issue where Metamask or WalletConnect will be triggered for login on first page load. Wagmi may fix that, or it could be with a change on Lock.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ideal behavior would be similar than Uniswap (which is using Wagmi), where user dont get Metamask or their wallet triggered if it's locked, but still autoconnect if it's not locked
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ideal behavior depends on some changes on lock side, and will be on another PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tACK
Let's merge this when we can actually, it make much easier to test |
Summary
Closes: https://github.com/snapshot-labs/workflow/issues/158
This PR will redirect logged in users to
/home
when requesting for/
How to test
Note
This will always show the Loading icon until the log in is complete.
When you're logged in, but with metamask locked, it will show the loading indicator until you unlock metamask, or reject the unlock.