bito-code-review[bot] commented on code in PR #36936:
URL: https://github.com/apache/superset/pull/36936#discussion_r2699827014
##########
superset-frontend/packages/superset-ui-core/src/components/Timer/index.tsx:
##########
@@ -35,7 +35,9 @@ export function Timer({
status = 'success',
}: TimerProps) {
const theme = useTheme();
- const [clockStr, setClockStr] = useState('00:00:00.00');
+ const [clockStr, setClockStr] = useState(
+ startTime && endTime ? fDuration(startTime, endTime) : '00:00:00.00',
+ );
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Logic Inconsistency in Timer Init</b></div>
<div id="fix">
The initial state computes fDuration without verifying startTime < endTime,
unlike the useEffect which checks this before updating. If startTime >=
endTime, this could display a negative duration initially, creating
inconsistent behavior with the timer updates.
</div>
<details>
<summary>
<b>Code suggestion</b>
</summary>
<blockquote>Check the AI-generated fix before applying</blockquote>
<div id="code">
````suggestion
const [clockStr, setClockStr] = useState(
startTime && endTime && startTime < endTime ? fDuration(startTime,
endTime) : '00:00:00.00',
);
````
</div>
</details>
</div>
<small><i>Code Review Run #0ff81a</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/SqlLab/actions/sqlLab.ts:
##########
@@ -392,7 +392,7 @@ export function startQuery(query: Query, runPreviewOnly?:
boolean) {
id: query.id ? query.id : nanoid(11),
progress: 0,
startDttm: now(),
- state: query.runAsync ? 'pending' : 'running',
+ state: 'pending',
cached: false,
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Incorrect sync query state</b></div>
<div id="fix">
This change always sets query state to 'pending', but synchronous queries
should show 'running' since they execute immediately. The UI expects 'running'
for sync queries to display the correct status in QueryStatusBar.
</div>
<details>
<summary>
<b>Code suggestion</b>
</summary>
<blockquote>Check the AI-generated fix before applying</blockquote>
<div id="code">
````suggestion
startDttm: now(),
state: query.runAsync ? 'pending' : 'running',
cached: false,
````
</div>
</details>
</div>
<small><i>Code Review Run #0ff81a</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]