Copilot commented on code in PR #15657: URL: https://github.com/apache/pinot/pull/15657#discussion_r2062943845
########## pinot-controller/src/main/resources/app/pages/TenantDetails.tsx: ########## @@ -279,6 +304,38 @@ const TenantPageDetails = ({ match }: RouteComponentProps<Props>) => { useEffect(() => { fetchTableData(); }, []); + // Fetch pause status once tableType is known + useEffect(() => { + if (tableType.toLowerCase() === TableType.REALTIME) { + setLoadingPauseStatus(true); + PinotMethodUtils.getPauseStatusData(tableName) + .then((data: PauseStatusDetails) => setPauseStatusData(data)) + .catch((error: any) => dispatch({ type: 'error', message: `Error fetching pause status: ${error}`, show: true })) + .finally(() => setLoadingPauseStatus(false)); + } else { + setPauseStatusData(null); + } + }, [tableType, tableName]); + // Cleanup polling on unmount + useEffect(() => { + return () => { + if (pausePollingRef.current) { + clearInterval(pausePollingRef.current); + } + }; + }, []); + // Fetch pause status once tableType is known + useEffect(() => { + if (tableType.toLowerCase() === TableType.REALTIME) { + setLoadingPauseStatus(true); + PinotMethodUtils.getPauseStatusData(tableName) + .then((data: PauseStatusDetails) => setPauseStatusData(data)) + .catch((error: any) => dispatch({ type: 'error', message: `Error fetching pause status: ${error}`, show: true })) + .finally(() => setLoadingPauseStatus(false)); + } else { + setPauseStatusData(null); + } + }, [tableType, tableName]); Review Comment: A duplicate useEffect block for fetching pause status is present (lines 308–318 and 328–337). Consider removing one to avoid redundant API calls. ```suggestion // (Removed duplicate useEffect block) ``` -- 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: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org