bito-code-review[bot] commented on code in PR #38563:
URL: https://github.com/apache/superset/pull/38563#discussion_r2913322230
##########
superset-frontend/src/features/reports/ReportModal/index.tsx:
##########
@@ -366,7 +367,7 @@ function ReportModal({
}}
onError={setCronError}
/>
- <StyledCronError>{cronError}</StyledCronError>
+ <StyledCronError>{cronError as ReactNode}</StyledCronError>
<div
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Incorrect cron error display</b></div>
<div id="fix">
Rendering the cronError object directly will show '[object Object]' instead
of the error message. CronError from react-js-cron is an object with 'type' and
'description' properties - the description should be displayed.
</div>
<details>
<summary>
<b>Code suggestion</b>
</summary>
<blockquote>Check the AI-generated fix before applying</blockquote>
<div id="code">
````suggestion
/>
<StyledCronError>{cronError?.description}</StyledCronError>
<div
````
</div>
</details>
</div>
<small><i>Code Review Run #139db3</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/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/getControlItemsMap.tsx:
##########
@@ -219,11 +221,14 @@ export default function getControlItemsMap({
}}
>
<>
- {controlItem.config.label}
+ {typeof controlItem.config.label === 'function'
+ ? (controlItem.config.label as Function)()
+ : controlItem.config.label}
+
{controlItem.config.description && (
<InfoTooltip
placement="top"
- tooltip={controlItem.config.description}
+ tooltip={controlItem.config.description as
React.ReactNode}
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Inconsistent function handling for config
properties</b></div>
<div id="fix">
The tooltip prop casts controlItem.config.description directly to ReactNode,
but according to the BaseControlConfig type, description can be a function that
returns ReactNode, just like label. This inconsistency could cause runtime
errors if description is a function. It looks like the change handles label
functions but missed description.
</div>
<details>
<summary>
<b>Code suggestion</b>
</summary>
<blockquote>Check the AI-generated fix before applying</blockquote>
<div id="code">
````suggestion
tooltip={typeof controlItem.config.description ===
'function' ? (controlItem.config.description as Function)() :
controlItem.config.description as React.ReactNode}
````
</div>
</details>
</div>
<small><i>Code Review Run #139db3</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]