bito-code-review[bot] commented on code in PR #42112:
URL: https://github.com/apache/superset/pull/42112#discussion_r3882376451
##########
superset-frontend/src/dashboard/components/gridComponents/DynamicComponent/DynamicComponent.tsx:
##########
@@ -158,7 +158,7 @@ const DynamicComponent: FC<DynamicComponentProps> = ({
onResizeStop={onResizeStop}
>
<div
- ref={dragSourceRef}
+ ref={dragSourceRef as unknown as React.Ref<HTMLDivElement>}
className="dashboard-component"
data-test="dashboard-component-chart-holder"
>
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Double type assertion bypasses type safety</b></div>
<div id="fix">
The `as unknown as React.Ref<HTMLDivElement>` double-cast bypasses
TypeScript's type checking entirely, violating the repo's 'NO any types' policy
(AGENTS.md, dev-standard.mdc). The established pattern in `ChartHolder.tsx`
uses a proper callback ref wrapper instead. Replace with `ref={el =>
dragSourceRef(el)}` to maintain type safety.
</div>
<details>
<summary>
<b>Code suggestion</b>
</summary>
<blockquote>Check the AI-generated fix before applying</blockquote>
<div id="code">
````suggestion
onResizeStop={onResizeStop}
>
<div
ref={el => dragSourceRef(el)}
className="dashboard-component"
data-test="dashboard-component-chart-holder"
>
````
</div>
</details>
</div>
<small><i>Code Review Run #f36098</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/plugins/preset-chart-deckgl/src/layers/Contour/Contour.tsx:
##########
@@ -167,7 +167,7 @@ export const getLayer: GetLayerType<ContourLayer> =
function ({
cellSize: safeCellSize,
aggregation: aggregation.toUpperCase(),
getPosition: (d: { position: number[]; weight: number }) =>
- d.position as Position,
+ d.position as unknown as Position,
getWeight: (d: { weight: number }) => d.weight || 0,
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Double-cast bypasses type safety</b></div>
<div id="fix">
The `as unknown as Position` double-cast bypasses TypeScript's type safety.
`Position` from `@deck.gl/core` is a tuple type `[lng, lat, alt?]`, not
`number[]`. The cleaner fix is to type `position` as `Position` directly in the
parameter, matching the pattern already used in `Heatmap.tsx` (lines 143, 196).
This avoids the unsafe cast and aligns with the repo's 'NO any types' guidance
in AGENTS.md.
</div>
<details>
<summary>
<b>Code suggestion</b>
</summary>
<blockquote>Check the AI-generated fix before applying</blockquote>
<div id="code">
````suggestion
aggregation: aggregation.toUpperCase(),
getPosition: (d: { position: Position; weight: number }) =>
d.position,
getWeight: (d: { weight: number }) => d.weight || 0,
````
</div>
</details>
</div>
<small><i>Code Review Run #f36098</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]