korbit-ai[bot] commented on code in PR #33040:
URL: https://github.com/apache/superset/pull/33040#discussion_r2033419554
##########
superset-frontend/src/pages/ChartList/index.tsx:
##########
@@ -233,6 +237,17 @@ function ChartList(props: ChartListProps) {
addSuccessToast(t('Chart imported'));
};
+ const openBulkUpdateOwnersModal = (selected: Chart[]) => {
+ setBulkSelected(selected);
+ setShowBulkUpdateOwnersModal(true);
+ };
+
+ const closeBulkUpdateOwnersModal = () => {
+ setShowBulkUpdateOwnersModal(false);
+ setBulkSelected([]);
+ refreshData();
+ };
Review Comment:
### Unnecessary Data Refresh on Modal Close <sub></sub>
<details>
<summary>Tell me more</summary>
###### What is the issue?
The refreshData call in closeBulkUpdateOwnersModal is unconditional, meaning
it will refresh the data even when the modal is closed without making any
changes.
###### Why this matters
Unnecessary API calls will be made when users simply open and close the
modal without making changes, potentially impacting performance and user
experience.
###### Suggested change ∙ *Feature Preview*
The refreshData call should only be made when actual changes have occurred.
Modify the code to use a success callback from BulkUpdateOwnersModal:
```typescript
const closeBulkUpdateOwnersModal = (refreshNeeded = false) => {
setShowBulkUpdateOwnersModal(false);
setBulkSelected([]);
if (refreshNeeded) {
refreshData();
}
};
```
###### Provide feedback to improve future suggestions
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/a7b27e4f-ea0b-4759-8a55-daccea525146/upvote)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/a7b27e4f-ea0b-4759-8a55-daccea525146?what_not_true=true)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/a7b27e4f-ea0b-4759-8a55-daccea525146?what_out_of_scope=true)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/a7b27e4f-ea0b-4759-8a55-daccea525146?what_not_in_standard=true)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/a7b27e4f-ea0b-4759-8a55-daccea525146)
</details>
<sub>
💬 Looking for more details? Reply to this comment to chat with Korbit.
</sub>
<!--- korbi internal id:7c69cc5c-04c1-480c-8e8e-548cd94f5000 -->
[](7c69cc5c-04c1-480c-8e8e-548cd94f5000)
--
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]