@@ -14,6 +14,8 @@ import InputContainer from "../InputContainer";
14
14
import SearchContainer from "../SearchContainer" ;
15
15
import SubmitContainer from "../SubmitContainer" ;
16
16
17
+ const SEARCHINGTIME = 1600 ;
18
+
17
19
function SearchAndSubmit ( props ) {
18
20
const { stages, setStages, searchObject, onClick, page } = props ;
19
21
@@ -48,6 +50,7 @@ function SearchAndSubmit(props) {
48
50
if ( previousSearchId ) {
49
51
searchObjectCopy . previousRoleSearchRequestId = previousSearchId ;
50
52
}
53
+ const searchingBegin = Date . now ( ) ;
51
54
searchRoles ( searchObjectCopy )
52
55
. then ( ( res ) => {
53
56
const name = _ . get ( res , "data.name" ) ;
@@ -63,8 +66,13 @@ function SearchAndSubmit(props) {
63
66
console . error ( err ) ;
64
67
} )
65
68
. 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
+ ) ;
68
76
} ) ;
69
77
// eslint-disable-next-line react-hooks/exhaustive-deps
70
78
} , [ dispatch , previousSearchId , searchObject ] ) ;
0 commit comments