-
Notifications
You must be signed in to change notification settings - Fork 2
[demo_web] add isSignedInRef to track recent state in getKey callback #61
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
Conversation
apps/demo_web/src/hooks/wallet.ts
Outdated
| okoCosmos | ||
| .getKey("cosmoshub-4") | ||
| .then((key) => setCosmosAddress(key.bech32Address)), | ||
| okoCosmos.getKey("cosmoshub-4").then((key) => { |
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.
hardcoded string?
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.
Do you think make it constant vars?
I just thought it is used just one time and in local
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.
Yes, it'd be better if we have const COSMOSHUB_4
| const okoEth = useSDKState((state) => state.oko_eth); | ||
| const isSignedIn = useUserInfoState((state) => state.isSignedIn); | ||
| const isSignedRef = useRef(isSignedIn); | ||
| isSignedRef.current = isSignedIn; |
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 necessary?
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 reference the latest state of isSignedIn in the callback, add a ref variable.
^ as I mentioned PR, Within the callback function, it is necessary to retrieve the most recent isSignedIn state.
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.
@blacktoast I still don't see why this ref is necessary. Could we hop on a short call when you are available?
|
btw, this has some conflicts. Could you take a look into it? @blacktoast |
| @@ -0,0 +1 @@ | |||
| export const COSMOS_CHAIN_ID = "cosmoshub-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.
constants can be anything. Too general this file is.
Pull Request
CONTRIBUTING.mdand followed the guidelines.Summary
구현 사항
isSignedInin the callback, add a ref variable.yarn checkto formatLinks (Issue References, etc, if there's any)