Skip to content

Commit 8aef36f

Browse files
committed
fix(deposit): add isloading guard
1 parent bcf9122 commit 8aef36f

File tree

1 file changed

+11
-4
lines changed
  • app/components/UI/Ramp/Deposit/Views/OtpCode

1 file changed

+11
-4
lines changed

app/components/UI/Ramp/Deposit/Views/OtpCode/OtpCode.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ const OtpCode = () => {
155155
}, []);
156156

157157
const handleSubmit = useCallback(async () => {
158-
if (value.length === CELL_COUNT) {
158+
if (!isLoading && value.length === CELL_COUNT) {
159159
try {
160160
setIsLoading(true);
161161
setError(null);
@@ -175,18 +175,25 @@ const OtpCode = () => {
175175
setIsLoading(false);
176176
}
177177
}
178-
}, [quote, routeAfterAuthentication, setAuthToken, submitCode, value.length]);
178+
}, [
179+
isLoading,
180+
quote,
181+
routeAfterAuthentication,
182+
setAuthToken,
183+
submitCode,
184+
value.length,
185+
]);
179186

180187
const handleValueChange = useCallback((text: string) => {
181188
setValue(text);
182189
setError(null);
183190
}, []);
184191

185192
useEffect(() => {
186-
if (value.length === CELL_COUNT) {
193+
if (value.length === CELL_COUNT && !isLoading) {
187194
handleSubmit();
188195
}
189-
}, [value, handleSubmit]);
196+
}, [value, handleSubmit, isLoading]);
190197

191198
return (
192199
<ScreenLayout>

0 commit comments

Comments
 (0)