Copilot commented on code in PR #16591:
URL: https://github.com/apache/pinot/pull/16591#discussion_r2274797609
##########
pinot-controller/src/main/resources/app/pages/TaskDetail.tsx:
##########
@@ -115,10 +115,12 @@ const TaskDetail = (props) => {
}
const filtered = subtaskTableData.records.filter(([_, status]) => {
- const subtaskStatus = typeof status === 'object' && status !== null &&
'value' in status
- ? status.value as string
- : status as string;
- return subtaskStatus.toUpperCase() === subtaskStatusFilter;
+ const rawStatus = (typeof status === 'object' && status !== null &&
'value' in status)
+ ? (status as { value?: unknown }).value
+ : status;
+ const statusString = typeof rawStatus === 'string' ? rawStatus : '';
+ const normalized = statusString.toUpperCase() === 'TIMEDOUT' ?
'TIMED_OUT' : statusString.toUpperCase();
Review Comment:
The normalization logic calls `statusString.toUpperCase()` twice. Consider
storing the result in a variable to avoid redundant computation.
```suggestion
const statusUpper = statusString.toUpperCase();
const normalized = statusUpper === 'TIMEDOUT' ? 'TIMED_OUT' :
statusUpper;
```
##########
pinot-controller/src/main/resources/app/components/useTaskListing.tsx:
##########
@@ -49,25 +49,30 @@ export default function useTaskListing(props) {
}
const filtered = tasks.records.filter(([_, status]) => {
- const taskStatus = typeof status === 'object' && status !== null &&
'value' in status
- ? status.value as string
- : status as string;
- return taskStatus.toUpperCase() === statusFilter;
+ const rawStatus = (typeof status === 'object' && status !== null &&
'value' in status)
+ ? (status as { value?: unknown }).value
+ : status;
+ const statusString = typeof rawStatus === 'string' ? rawStatus : '';
+ const normalized = statusString.toUpperCase() === 'TIMEDOUT' ?
'TIMED_OUT' : statusString.toUpperCase();
Review Comment:
The normalization logic calls `statusString.toUpperCase()` twice. Consider
storing the result in a variable to avoid redundant computation and improve
code consistency with the fix in TaskDetail.tsx.
```suggestion
const upperStatus = statusString.toUpperCase();
const normalized = upperStatus === 'TIMEDOUT' ? 'TIMED_OUT' :
upperStatus;
```
--
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]