-
Notifications
You must be signed in to change notification settings - Fork 3.9k
multiple rerenders signin screen #74555
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
Merged
mountiny
merged 8 commits into
Expensify:main
from
callstack-internal:fix/1736/multiple-rerenders-signin
Nov 21, 2025
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
1447e45
feat: add ValidateCodeCountdown component for managing code resend co…
BartekObudzinski 5395920
refactor: use ValidateCodeCountdown component to manage resend countd…
BartekObudzinski d6a4df0
commented unused inmport removed
BartekObudzinski d2c5f0d
chore: pretteir run
BartekObudzinski 6dd3310
refactor: add type for timeRemaining state
BartekObudzinski 07814a2
refactor: integrate ValidateCodeCountdown for improved countdown mana…
BartekObudzinski baf071f
feature: memoize the handleCountdownFinish method
BartekObudzinski ab63bde
feat: add displayName to ValidateCodeCountdown
BartekObudzinski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| import React, {forwardRef, useEffect, useImperativeHandle, useRef, useState} from 'react'; | ||
| import RenderHTML from '@components/RenderHTML'; | ||
| import useLocalize from '@hooks/useLocalize'; | ||
| import CONST from '@src/CONST'; | ||
| import type {ValidateCodeCountdownHandle, ValidateCodeCountdownProps} from './types'; | ||
|
|
||
| function ValidateCodeCountdown({onCountdownFinish}: ValidateCodeCountdownProps, ref: React.ForwardedRef<ValidateCodeCountdownHandle>) { | ||
| const {translate} = useLocalize(); | ||
|
|
||
| const [timeRemaining, setTimeRemaining] = useState<number>(CONST.REQUEST_CODE_DELAY); | ||
| const timerRef = useRef<NodeJS.Timeout | undefined>(undefined); | ||
|
|
||
| useImperativeHandle(ref, () => ({ | ||
| resetCountdown: () => setTimeRemaining(CONST.REQUEST_CODE_DELAY), | ||
| })); | ||
|
|
||
| useEffect(() => { | ||
| if (timeRemaining > 0) { | ||
| timerRef.current = setTimeout(() => { | ||
| setTimeRemaining((prev) => prev - 1); | ||
| }, 1000); | ||
| } else { | ||
| onCountdownFinish(); | ||
| } | ||
| return () => { | ||
| clearTimeout(timerRef.current); | ||
| }; | ||
|
BartekObudzinski marked this conversation as resolved.
|
||
| }, [onCountdownFinish, timeRemaining]); | ||
|
|
||
| return ( | ||
| <RenderHTML | ||
| html={translate('validateCodeForm.requestNewCode', { | ||
| timeRemaining: `00:${String(timeRemaining).padStart(2, '0')}`, | ||
| })} | ||
| /> | ||
| ); | ||
| } | ||
|
|
||
| ValidateCodeCountdown.displayName = 'ValidateCodeCountdown'; | ||
|
|
||
| export default forwardRef(ValidateCodeCountdown); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| type ValidateCodeCountdownProps = { | ||
| onCountdownFinish: () => void; | ||
| }; | ||
|
|
||
| type ValidateCodeCountdownHandle = { | ||
| resetCountdown: () => void; | ||
| }; | ||
|
|
||
| export type {ValidateCodeCountdownHandle, ValidateCodeCountdownProps}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.