jtjenkins commented on code in PR #39894:
URL: https://github.com/apache/superset/pull/39894#discussion_r3461888585


##########
superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterValue.tsx:
##########
@@ -185,6 +200,27 @@ const FilterValue: FC<FilterValueProps> = ({
   const [isRefreshing, setIsRefreshing] = useState(false);
   const dispatch = useDispatch();
 
+  // When a Date Range parent filter is active, the child filter needs
+  // granularity_sqla to apply the temporal WHERE clause. Read main_dttm_col
+  // from the Redux datasource cache as a fallback.
+  //
+  // The dashboard datasets API (/api/v1/dashboard/:id/datasets) only returns
+  // datasets used by chart slices, so native-filter-only datasets are never
+  // in state.datasources. Dispatch fetchDatasourceMetadata at mount time to
+  // populate the cache explicitly for those datasets.
+  const datasourceMainDttmCol = useSelector<RootState, string | undefined>(
+    state =>
+      datasetId != null
+        ? state.datasources?.[`${datasetId}__table`]?.main_dttm_col
+        : undefined,
+  );
+
+  useEffect(() => {
+    if (datasetId != null) {
+      dispatch(fetchDatasourceMetadata(`${datasetId}__table`));

Review Comment:
   Fixed in 3c99fa2. The thunk re-throws to clear its in-flight guard, so the 
dispatched promise can reject. Wrapped the dispatch in 
`Promise.resolve(...).catch(...)` and log via `logging.warn` — the metadata 
fetch is a best-effort cache prime for the granularity_sqla fallback, so a 
failure is non-fatal but no longer surfaces as an unhandled rejection.



##########
superset-frontend/src/dashboard/actions/datasources.test.ts:
##########
@@ -0,0 +1,105 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { SupersetClient } from '@superset-ui/core';
+import { RootState } from 'src/dashboard/types';
+import {
+  DatasourcesAction,
+  fetchDatasourceMetadata,
+  setDatasource,
+} from './datasources';
+
+const KEY = '7__table';
+
+const buildGetState =
+  (datasources: Record<string, any> = {}) =>

Review Comment:
   Fixed in 3c99fa2. Replaced the `any` casts across this file — the state 
helper now uses `DatasourcesState`, the cached fixture is typed `Datasource`, 
and the `SupersetClient.get` mocks use the client's resolved response type 
(`Awaited<ReturnType<typeof SupersetClient.get>>`) via `unknown` rather than 
`any`, in line with the repo's no-`any` rule.



-- 
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]

Reply via email to