EnxDev commented on code in PR #43454:
URL: https://github.com/apache/superset/pull/43454#discussion_r3879669681
##########
superset-frontend/src/explore/components/DataTablesPane/components/ResultsPaneOnDashboard.tsx:
##########
@@ -86,9 +79,25 @@ export const ResultsPaneOnDashboard = ({
};
});
+ const resultsTabFallback = getStaleResultsTabFallback(
Review Comment:
Yes, it can shrink even if no plugin ever sets `dynamicQueryObjectCount:
true`.
Consider the end of `useResultsPane`
([[useResultsPane.tsx:230–232](vscode-webview://03msa8759m0ieil9fgknfejjnv98udeg1o5qi9olm6r74uil1bk4/superset-frontend/src/explore/components/DataTablesPane/components/useResultsPane.tsx#L230-L232)](vscode-webview://03msa8759m0ieil9fgknfejjnv98udeg1o5qi9olm6r74uil1bk4/superset-frontend/src/explore/components/DataTablesPane/components/useResultsPane.tsx#L230-L232)):
```ts
const resultRespToDisplay = isQueryCountDynamic
? resultResp
: resultResp.slice(0, queryCount);
```
For a chart with a static `queryObjectCount`, this only caps `resultResp` at
`queryCount`; it never pads the array to reach that count. Therefore, the
number of panes rendered is effectively `min(resultResp.length, queryCount)`.
If a response contains fewer entries than declared by
`metadata.queryObjectCount`—for example, because one query in a mixed chart
fails, is filtered out server-side, or a forced refetch returns a partial
result—`resultResp.length` can become smaller than it was during the previous
render, causing the tab set to shrink. This does not require the dynamic flag.
You’re also right that no in-tree plugin currently sets
`dynamicQueryObjectCount: true`. That branch supports third-party and custom
plugins outside this monorepo: `ChartMetadata` is publicly exported by
`@superset-ui-core`, and the flag is part of its documented API. Therefore, it
remains a valid path even though no in-tree plugin currently exercises it.
In short, the fallback in `ResultsPaneOnDashboard` is not merely defensive.
The static-count shrink path is already reachable when a response contains
fewer results than declared, while the dynamic-count path is reachable by any
external plugin that opts into it.
--
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]