Skip to content

Commit e1cbc68

Browse files
committed
take loading_state out of selector
1 parent 603cbce commit e1cbc68

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

dash/dash-renderer/src/wrapper/DashWrapper.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {DashConfig} from '../config';
2323
import {notifyObservers, onError, updateProps} from '../actions';
2424
import {getWatchedKeys, stringifyId} from '../actions/dependencies';
2525
import {recordUiEdit} from '../persistence';
26-
import {createElement, isDryComponent} from './wrapping';
26+
import {createElement, getLoadingState, isDryComponent} from './wrapping';
2727
import Registry from '../registry';
2828
import isSimpleComponent from '../isSimpleComponent';
2929
import {
@@ -57,7 +57,7 @@ function DashWrapper({
5757
const config: DashConfig = useSelector(selectConfig);
5858

5959
// Select both the component and it's props.
60-
const [component, componentProps, loading_state] = useSelector(
60+
const [component, componentProps] = useSelector(
6161
selectDashProps(componentPath),
6262
selectDashPropsEqualityFn
6363
);
@@ -171,7 +171,11 @@ function DashWrapper({
171171
);
172172

173173
const extraProps = {
174-
loading_state,
174+
loading_state: getLoadingState(
175+
component,
176+
componentPath,
177+
(store.getState() as any).loadingMap
178+
),
175179
setProps,
176180
...extras
177181
};

dash/dash-renderer/src/wrapper/selectors.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,13 @@ import {
88
} from '../types/component';
99
import {getLoadingState} from './wrapping';
1010

11-
type SelectDashProps = [DashComponent, BaseDashProps, DashLoadingState];
11+
type SelectDashProps = [DashComponent, BaseDashProps];
1212

1313
export const selectDashProps =
1414
(componentPath: DashLayoutPath) =>
1515
(state: any): SelectDashProps => {
1616
const c = path(componentPath, state.layout) as DashComponent;
17-
const loading_state = getLoadingState(
18-
c,
19-
componentPath,
20-
state.loadingMap
21-
);
22-
return [c, c.props, loading_state];
17+
return [c, c.props];
2318
};
2419

2520
export function selectDashPropsEqualityFn(

0 commit comments

Comments
 (0)