korbit-ai[bot] commented on code in PR #33963:
URL: https://github.com/apache/superset/pull/33963#discussion_r2173185341
##########
superset-frontend/plugins/plugin-chart-handlebars/src/plugin/index.ts:
##########
@@ -22,6 +22,7 @@ import example1 from '../images/example1.jpg';
import example2 from '../images/example2.jpg';
import buildQuery from './buildQuery';
import controlPanel from './controlPanel';
+import { serverPaginationControlSetRow } from './controls/pagination';
Review Comment:
### Missing validation for pagination row existence <sub></sub>
<details>
<summary>Tell me more</summary>
###### What is the issue?
The code imports 'serverPaginationControlSetRow' but there's no validation
to ensure it exists in the control panel's rows before attempting to filter it
out.
###### Why this matters
If 'serverPaginationControlSetRow' is not present in the controlSetRows, the
filter operation will still proceed but might not have any effect, potentially
masking a configuration issue.
###### Suggested change ∙ *Feature Preview*
Add a validation check to ensure the row exists before attempting to remove
it:
```typescript
const cleanedControlPanel = {
...controlPanel,
controlPanelSections: controlPanel.controlPanelSections.map(section => {
if (section?.label === t('Query')) {
const hasRow =
section.controlSetRows.includes(serverPaginationControlSetRow);
if (!hasRow) {
console.warn('serverPaginationControlSetRow not found in Query
section');
return section;
}
return {
...section,
controlSetRows: section.controlSetRows.filter(
row => row !== serverPaginationControlSetRow,
),
};
}
return section;
}),
};
```
###### Provide feedback to improve future suggestions
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/8ce0b8ad-43fe-444e-911a-68cb10f9f53b/upvote)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/8ce0b8ad-43fe-444e-911a-68cb10f9f53b?what_not_true=true)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/8ce0b8ad-43fe-444e-911a-68cb10f9f53b?what_out_of_scope=true)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/8ce0b8ad-43fe-444e-911a-68cb10f9f53b?what_not_in_standard=true)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/8ce0b8ad-43fe-444e-911a-68cb10f9f53b)
</details>
<sub>
💬 Looking for more details? Reply to this comment to chat with Korbit.
</sub>
<!--- korbi internal id:81490229-bb49-479c-a27d-616b840d1966 -->
[](81490229-bb49-479c-a27d-616b840d1966)
--
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]