sadpandajoe commented on code in PR #44452: URL: https://github.com/apache/superset/pull/44452#discussion_r4232582212
########## superset-frontend/packages/superset-ui-chart-controls/src/utils/isServerPaginationUnsupported.ts: ########## @@ -0,0 +1,62 @@ +/** + * 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 { DatasourceType } from '@superset-ui/core'; +import type { ControlPanelState } from '../types'; + +/** SemanticViewFeature value for providers that support row offsets. */ +export const ROW_OFFSET = 'ROW_OFFSET'; + +/** Only selected-datasource metadata can describe its capabilities. */ +export function hasMatchingDatasourceMetadata({ + datasource, + form_data, +}: Pick<ControlPanelState, 'datasource' | 'form_data'>): boolean { + return Boolean( + datasource && + 'uid' in datasource && + datasource.uid === form_data.datasource, Review Comment: On a normal Explore load `form_data.datasource` is `<id>__semantic_view` (set in `ExploreGetCommand`), while `datasource.uid` for a semantic view is the provider's opaque `implementation.uid()`, so this equality is false. `hasMatchingDatasourceMetadata` then returns false, `features` is dropped to `undefined`, and `isServerPaginationUnsupported` returns true even for a view that advertises `ROW_OFFSET`. A user opening a saved or fresh chart on such a view would see Server pagination disabled and never able to enable it, unless the provider's uid happens to be literally `<id>__semantic_view`. Should the match compare `datasource.id`/`type` against the parsed form value, or is there a path that rewrites `form_data.datasource` to the provider uid before the control panel runs? -- 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]
