Skip to content

Commit bb216b4

Browse files
authored
perf(sidebar): Lazy load sidebar panels without 500ms delay (#1223)
1 parent 05d86b1 commit bb216b4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/elements/common/async-load/AsyncLoad.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ const DEFAULT_BACKOFF_FACTOR = 2;
1919
const NullComponent = () => null;
2020

2121
const AsyncLoad = (asyncProps: Props = {}) => {
22-
const asyncLoadWithRetry = () =>
22+
const retryAsyncLoad = () =>
2323
retryNumOfTimes(
2424
(successCallback, errorCallback) => asyncProps.loader().then(successCallback, errorCallback),
2525
DEFAULT_NUM_TIMES,
2626
DEFAULT_INITIAL_DELAY,
2727
DEFAULT_BACKOFF_FACTOR,
2828
);
29-
const LazyComponent = React.lazy(asyncLoadWithRetry);
29+
const LazyComponent = React.lazy(() => asyncProps.loader().catch(retryAsyncLoad));
3030

3131
return class extends React.Component<Object, State> {
3232
state = {

0 commit comments

Comments
 (0)