-
Notifications
You must be signed in to change notification settings - Fork 25
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/set username dialog #3784
Feat/set username dialog #3784
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
variables: { | ||
userName, | ||
}, | ||
refetchQueries: [ |
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 these are not required since the response of the mutation will auto update to local cache? Please confirm, thanks.
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.
Doesn't update local cache automatically
initUserName = | ||
pureUserName.slice(0, MAX_USER_NAME_LENGTH - 3) + | ||
String(index + 1).padStart(3, '0') | ||
setIndex(index + 1) |
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.
Is random number as the initUserName
better than it starts from 001
? or do we have better solutions like get via API (cc @gary02 )?
if (!email) { | ||
return | ||
} | ||
const { data } = await client.query({ |
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.
should set a maximum tries to avoid dead loop.
|
||
useEffect(() => { | ||
;(async () => { | ||
if (!email) { |
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.
shall we use SocialAccount.userName
as fallback? Please confirm with designer, thanks!
const viewer = useContext(ViewerContext) | ||
const client = useApolloClient() | ||
|
||
const maxQueryCount = 1000 |
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.
Assume the avg response time is ~500ms, 5
to 10
times are enough if we don't want user to wait too long? User can input the userName manually.
No description provided.