Skip to content
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

Merged
merged 10 commits into from
Sep 4, 2023
Merged

Feat/set username dialog #3784

merged 10 commits into from
Sep 4, 2023

Conversation

wlliaml
Copy link
Contributor

@wlliaml wlliaml commented Sep 1, 2023

No description provided.

@wlliaml wlliaml requested a review from robertu7 September 1, 2023 06:03
@wlliaml wlliaml requested a review from a team as a code owner September 1, 2023 06:03
@vercel
Copy link

vercel bot commented Sep 1, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
matters-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 4, 2023 8:52am

@wlliaml wlliaml linked an issue Sep 1, 2023 that may be closed by this pull request
3 tasks
variables: {
userName,
},
refetchQueries: [
Copy link
Contributor

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.

Copy link
Contributor Author

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)
Copy link
Contributor

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({
Copy link
Contributor

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.

src/components/Dialogs/SetUserNameDialog/Content.tsx Outdated Show resolved Hide resolved

useEffect(() => {
;(async () => {
if (!email) {
Copy link
Contributor

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!

src/components/Dialogs/SetUserNameDialog/ConfirmStep.tsx Outdated Show resolved Hide resolved
src/components/Dialogs/SetUserNameDialog/InputStep.tsx Outdated Show resolved Hide resolved
src/components/Dialogs/SetUserNameDialog/InputStep.tsx Outdated Show resolved Hide resolved
const viewer = useContext(ViewerContext)
const client = useApolloClient()

const maxQueryCount = 1000
Copy link
Contributor

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.

@wlliaml wlliaml merged commit 1c4f2ee into feat/New-Login Sep 4, 2023
4 checks passed
@delete-merged-branch delete-merged-branch bot deleted the feat/set-username-dialog branch September 4, 2023 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dialog: SetUserName
2 participants