File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
web-app/src/screens/Console/Buckets/ListBuckets/Objects/ObjectDetails Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ import { api } from "api";
40
40
import { errorToHandler } from "api/errors" ;
41
41
import { getMaxShareLinkExpTime } from "screens/Console/ObjectBrowser/objectBrowserThunks" ;
42
42
import { maxShareLinkExpTime } from "screens/Console/ObjectBrowser/objectBrowserSlice" ;
43
+ import debounce from "lodash/debounce" ;
43
44
44
45
interface IShareFileProps {
45
46
open : boolean ;
@@ -64,15 +65,15 @@ const ShareFile = ({
64
65
const [ dateValid , setDateValid ] = useState < boolean > ( true ) ;
65
66
const [ versionID , setVersionID ] = useState < string > ( "null" ) ;
66
67
67
- const dateChanged = ( newDate : string , isValid : boolean ) => {
68
+ const debouncedDateChange = debounce ( ( newDate : string , isValid : boolean ) => {
68
69
setDateValid ( isValid ) ;
69
70
if ( isValid ) {
70
71
setSelectedDate ( newDate ) ;
71
72
return ;
72
73
}
73
74
setSelectedDate ( "" ) ;
74
75
setShareURL ( "" ) ;
75
- } ;
76
+ } , 300 ) ;
76
77
77
78
useEffect ( ( ) => {
78
79
dispatch ( getMaxShareLinkExpTime ( ) ) ;
@@ -214,7 +215,7 @@ const ShareFile = ({
214
215
id = "date"
215
216
label = "Active for"
216
217
maxSeconds = { maxShareLinkExpTimeVal }
217
- onChange = { dateChanged }
218
+ onChange = { debouncedDateChange }
218
219
entity = "Link"
219
220
/>
220
221
</ Grid >
You can’t perform that action at this time.
0 commit comments