Skip to content

Commit 8597adb

Browse files
committed
1 parent c7b3739 commit 8597adb

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/routes/CreateNewTeam/components/SearchAndSubmit/index.jsx

+10-2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import InputContainer from "../InputContainer";
1414
import SearchContainer from "../SearchContainer";
1515
import SubmitContainer from "../SubmitContainer";
1616

17+
const SEARCHINGTIME = 1600;
18+
1719
function SearchAndSubmit(props) {
1820
const { stages, setStages, searchObject, onClick, page } = props;
1921

@@ -48,6 +50,7 @@ function SearchAndSubmit(props) {
4850
if (previousSearchId) {
4951
searchObjectCopy.previousRoleSearchRequestId = previousSearchId;
5052
}
53+
const searchingBegin = Date.now();
5154
searchRoles(searchObjectCopy)
5255
.then((res) => {
5356
const name = _.get(res, "data.name");
@@ -63,8 +66,13 @@ function SearchAndSubmit(props) {
6366
console.error(err);
6467
})
6568
.finally(() => {
66-
setCurrentStage(2, stages, setStages);
67-
setSearchState("done");
69+
_.delay(
70+
() => {
71+
setCurrentStage(2, stages, setStages);
72+
setSearchState("done");
73+
},
74+
Date.now() - searchingBegin > SEARCHINGTIME ? 0 : 1500
75+
);
6876
});
6977
// eslint-disable-next-line react-hooks/exhaustive-deps
7078
}, [dispatch, previousSearchId, searchObject]);

src/routes/CreateNewTeam/components/SearchCard/index.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ function SearchCard() {
1919
setSearchState("state1");
2020
timer2 = setTimeout(() => {
2121
setSearchState("state2");
22-
}, 800);
23-
}, 800);
22+
}, 500);
23+
}, 500);
2424

2525
return () => {
2626
clearTimeout(timer1);

0 commit comments

Comments
 (0)