You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/10/17 16:32:25 UTC
[GitHub] [superset] kgabryje commented on a diff in pull request #20934: feat(explore): Don't discard controls with custom sql when changing datasource
kgabryje commented on code in PR #20934:
URL: https://github.com/apache/superset/pull/20934#discussion_r997281236
##########
superset-frontend/src/explore/components/ControlPanelsContainer.tsx:
##########
@@ -269,6 +270,29 @@ export const ControlPanelsContainer = (props: ControlPanelsContainerProps) => {
const containerRef = useRef<HTMLDivElement>(null);
+ const controlsTransferred = useSelector<ExplorePageState, string[]>(
+ state => state.explore.controlsTransferred,
+ );
+
+ useEffect(() => {
+ if (props.chart.chartStatus === 'success') {
+ controlsTransferred.forEach(controlName => {
+ const alteredControls = ensureIsArray(
+ props.controls[controlName].value,
+ ).map(value => {
+ if (
+ typeof value === 'object' &&
+ isDefined(value) &&
+ 'datasourceWarning' in value
Review Comment:
Unfortunately the typing of that area of code is very poor and `value`'s type is basically any object, so addind `datasourceWarning` to typing here would require a lot of restructuring which is not a focus of this PR.
However, I think `'fieldName' in objectName` is a rather common pattern, we use it in many places in the code, including typescript files
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org