bito-code-review[bot] commented on code in PR #33002:
URL: https://github.com/apache/superset/pull/33002#discussion_r2320592755
##########
superset-frontend/src/pages/DatasetList/index.tsx:
##########
@@ -887,14 +887,6 @@ const DatasetList: FunctionComponent<DatasetListProps> = ({
>
{confirmDelete => {
const bulkActions: ListViewProps['bulkActions'] = [];
- if (canDelete) {
- bulkActions.push({
- key: 'delete',
- name: t('Delete'),
- onSelect: confirmDelete,
- type: 'danger',
- });
- }
if (canExport) {
bulkActions.push({
key: 'export',
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Missing bulk delete functionality</b></div>
<div id="fix">
The delete bulk action functionality has been completely removed and
replaced with an incomplete export action. This breaks the bulk delete feature
for datasets. The export action is also missing required properties (name,
type, onSelect). Both export and delete bulk actions should be present with
complete implementations.
</div>
<details>
<summary>
<b>Code suggestion</b>
</summary>
<blockquote>Check the AI-generated fix before applying</blockquote>
<div id="code">
```suggestion
if (canExport) {
bulkActions.push({
key: 'export',
name: t('Export'),
type: 'primary',
onSelect: handleBulkDatasetExport,
});
}
if (canDelete) {
bulkActions.push({
key: 'delete',
name: t('Delete'),
onSelect: confirmDelete,
type: 'danger',
});
}
```
</div>
</details>
</div>
<small><i>Code Review Run <a
href=https://github.com/apache/superset/pull/33002#issuecomment-3251347035>#3d58f6</a></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
##########
superset-frontend/src/components/ListView/ListView.tsx:
##########
@@ -337,6 +360,34 @@ export function ListView<T extends object = any>({
}
}, [gotoPage, loading, pageCount, pageIndex]);
+ const firstAction = bulkActions[0];
+ const dropdownActions = bulkActions.slice(1);
+
+ const handleMenuClick = (info: { key: React.Key }) => {
+ const keyStr = String(info.key);
+ const action = dropdownActions.find(a => a.key === keyStr);
+ if (action) {
+ action.onSelect(selectedFlatRows.map(r => r.original));
+ }
+ };
+
+ const handleBulkActionClick = async () => {
+ setIsBulkActionLoading(true);
+ try {
+ await firstAction.onSelect(selectedFlatRows.map(r => r.original));
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Missing null check for firstAction</b></div>
<div id="fix">
The `handleBulkActionClick` function calls `firstAction.onSelect()` without
checking if `firstAction` exists. When `bulkActions` array is empty,
`firstAction` will be `undefined`, causing a runtime error. Add a null check:
`if (!firstAction) return;` before accessing its properties.
</div>
<details>
<summary>
<b>Code suggestion</b>
</summary>
<blockquote>Check the AI-generated fix before applying</blockquote>
<div id="code">
```suggestion
const handleBulkActionClick = async () => {
if (!firstAction) return;
setIsBulkActionLoading(true);
try {
await firstAction.onSelect(selectedFlatRows.map(r => r.original));
```
</div>
</details>
</div>
<small><i>Code Review Run <a
href=https://github.com/apache/superset/pull/33002#issuecomment-3251347035>#3d58f6</a></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
##########
superset-frontend/src/components/ListView/ListView.tsx:
##########
@@ -271,6 +282,19 @@ export function ListView<T extends object = any>({
addSuccessToast,
addDangerToast,
}: ListViewProps<T>) {
+ const [showBulkTagModal, setShowBulkTagModal] = useState<boolean>(false);
+ const [isBulkActionLoading, setIsBulkActionLoading] = useState(false);
+
+ const bulkActions = [...initialBulkActions];
+ if (enableBulkTag) {
+ bulkActions.splice(1, 0, {
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Incorrect array insertion logic</b></div>
<div id="fix">
The `splice(1, 0, ...)` operation will incorrectly position the tag action
when `initialBulkActions` is empty. If `initialBulkActions` is empty, the tag
action becomes the primary button instead of a dropdown action. Use `push()` or
check array length before splicing.
</div>
<details>
<summary>
<b>Code suggestion</b>
</summary>
<blockquote>Check the AI-generated fix before applying</blockquote>
<div id="code">
```suggestion
bulkActions.push({
```
</div>
</details>
</div>
<small><i>Code Review Run <a
href=https://github.com/apache/superset/pull/33002#issuecomment-3251347035>#3d58f6</a></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]