bito-code-review[bot] commented on code in PR #41181:
URL: https://github.com/apache/superset/pull/41181#discussion_r3435596944
##########
superset-frontend/src/explore/components/SaveModal.tsx:
##########
@@ -162,6 +167,35 @@ class SaveModal extends Component<SaveModalProps,
SaveModalState> {
t('An error occurred while loading dashboard information.'),
);
}
+ } else {
+ const metadataDashboards = this.props.metadata?.dashboards;
+ if (metadataDashboards?.length) {
+ // Fallback: the chart is already on one or more dashboards (from
Explore API
+ // metadata). Pre-populate with the first dashboard the user can edit
so the
+ // "Save & go to dashboard" button works out of the box.
+ try {
+ let editable: Dashboard | undefined;
+ for (const { id } of metadataDashboards) {
+ // eslint-disable-next-line no-await-in-loop
+ const result = await this.loadDashboard(id).catch(() => null);
+ if (result && canUserEditDashboard(result, this.props.user)) {
+ editable = result as Dashboard;
+ break;
+ }
+ }
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Sequential loading performance regression</b></div>
<div id="fix">
This refactor changes from parallel (Promise.all) to sequential
(for...await) loading. The original loads all dashboards concurrently and finds
the first editable one; the new code loads one-by-one and stops at the first
editable. This is slower when an editable dashboard exists early (n-1
sequential delays) or when none exist (full sequential chain vs parallel). If
intentional for resource conservation, add a comment documenting this trade-off.
</div>
</div>
<small><i>Code Review Run #c85537</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
--
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]