Vitor-Avila commented on code in PR #40774:
URL: https://github.com/apache/superset/pull/40774#discussion_r3358369246
##########
superset/charts/data/dashboard_filter_context.py:
##########
@@ -78,13 +78,21 @@ def _is_filter_in_scope_for_chart(
position_json: dict[str, Any],
) -> bool:
"""
- Determines whether a native filter applies to a given chart. When
- chartsInScope is present on the filter config, uses that directly.
- Otherwise falls back to scope.rootPath and scope.excluded with
- the dashboard layout.
+ Determines whether a native filter applies to a given chart.
+
+ When chartsInScope is present on the filter config, uses that directly.
+ Otherwise falls back to scope.rootPath and scope.excluded with the
+ dashboard layout. Also considers charts that were added to the dashboard
+ but were not instantiated in the layout.
"""
if (charts_in_scope := filter_config.get("chartsInScope")) is not None:
- return chart_id in charts_in_scope
+ if chart_id in charts_in_scope:
+ return True
+
+ # If the chart is found in position_json and not in chartsInScope,
+ # it was explicitly excluded by the filter scope config.
+ if _find_chart_layout_item(chart_id, position_json) is not None:
+ return False
Review Comment:
`position_json` is passed as an argument to this method, typed as `dict[str,
Any]`. If it's not a `dict` we def have a bigger problem.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]