You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@superset.apache.org by GitBox <gi...@apache.org> on 2018/02/28 00:25:25 UTC
[GitHub] hughhhh commented on a change in pull request #4491: Introduce an onInit method for when a new viz_type is selected
hughhhh commented on a change in pull request #4491: Introduce an onInit method for when a new viz_type is selected
URL: https://github.com/apache/incubator-superset/pull/4491#discussion_r171111488
##########
File path: superset/assets/javascripts/explore/stores/store.js
##########
@@ -81,6 +81,9 @@ export function getControlsState(state, form_data) {
control.value = formData[k] !== undefined ? formData[k] : control.default;
controlsState[k] = control;
});
+ if (viz.onInit) {
+ viz.onInit(controlsState);
Review comment:
shouldn't we just `return viz.onInit(controlState)` Then in the function we can just return a new object:
```
onInit: (controlState) => {
return {
...controlState
time_grain_sqla: {
value: null
}
granularity: {
value: null
}
}
}
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services