Skip to content

Commit 00b10f2

Browse files
authored
Merge pull request #888 from Codeinwp/prf/connection-speed
fix: reduce loading time for plugin connection
2 parents 2447ec3 + 5621f4f commit 00b10f2

File tree

1 file changed

+8
-2
lines changed
  • assets/src/dashboard/parts/connecting

1 file changed

+8
-2
lines changed

assets/src/dashboard/parts/connecting/index.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,21 @@ const ConnectingLayout = () => {
2424
const [ progress, setProgress ] = useState( 0 );
2525
const [ step, setStep ] = useState( 0 );
2626
const [ timer, setTimer ] = useState( 0 );
27-
const maxTime = 25;
27+
const maxTime = 5;
2828

2929
const { sethasDashboardLoaded } = useDispatch( 'optimole' );
3030

3131
useEffect( () => {
3232
if ( timer <= maxTime ) {
33-
setTimeout( () => {
33+
const timeout = setTimeout( () => {
3434
updateProgress();
3535
}, 1000 );
36+
37+
return () => {
38+
if ( timeout ) {
39+
clearTimeout( timeout );
40+
}
41+
};
3642
}
3743
}, [ timer ]);
3844

0 commit comments

Comments
 (0)