graceguo-supercat commented on a change in pull request #10264:
URL:
https://github.com/apache/incubator-superset/pull/10264#discussion_r451921161
##########
File path: superset-frontend/src/explore/reducers/getInitialState.js
##########
@@ -21,27 +21,40 @@ import shortid from 'shortid';
import getToastsFromPyFlashMessages from
'../../messageToasts/utils/getToastsFromPyFlashMessages';
import { getChartKey } from '../exploreUtils';
import { getControlsState } from '../store';
-import { getFormDataFromControls } from '../controlUtils';
+import {
+ getFormDataFromControls,
+ applyMapStateToPropsToControl,
+} from '../controlUtils';
export default function getInitialState(bootstrapData) {
- const controls = getControlsState(bootstrapData, bootstrapData.form_data);
- const rawFormData = { ...bootstrapData.form_data };
-
+ const { form_data: rawFormData } = bootstrapData;
+ const slice = bootstrapData.slice;
+ const sliceName = slice ? slice.slice_name : null;
const bootstrappedState = {
...bootstrapData,
+ sliceName,
common: {
flash_messages: bootstrapData.common.flash_messages,
conf: bootstrapData.common.conf,
},
rawFormData,
- controls,
filterColumnOpts: [],
isDatasourceMetaLoading: false,
isStarred: false,
+ isInitializing: true,
};
+ bootstrappedState.controls = getControlsState(bootstrappedState,
rawFormData);
- const slice = bootstrappedState.slice;
- const sliceName = slice ? slice.slice_name : null;
+ // apply initial mapStateToProps for all controls, must execute AFTER
+ // bootstrappedState has initialized `controls`. Order of execution is not
Review comment:
why order of execution is not guaranteed? it looks like a regular for
loop?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]