Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the watch list mechanism for model route targets in the LLM models deployments page. The useWatchList hook is lifted from the TableList component to the parent Deployments component, allowing the watch connection to be paused and resumed when the page becomes inactive or active. However, a potential issue was identified in use-watch-list.ts where calling cancelWatch cancels the requests but does not clear the cached data or state. This can lead to stale or deleted items lingering in the UI when the watch is resumed, so it is recommended to clear the cache and state upon cancellation.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| const cancelWatch = useMemoizedFn(() => { | ||
| chunkRequestRef.current?.current?.cancel?.(); | ||
| listRequestTokenRef.current?.cancel?.(); | ||
| }); |
There was a problem hiding this comment.
When cancelWatch is called (e.g., when the tab becomes inactive), the watch connection is cancelled, but the cached data in cacheWatchDataListRef.current and watchDataList is not cleared. If any targets are deleted while the tab is inactive, they will not be sent as CREATE or UPDATE events when the watch is restarted upon the tab becoming active again. This will cause those deleted targets to linger in the UI indefinitely. Clearing the cache and state on cancel ensures data consistency when the watch is resumed.
const cancelWatch = useMemoizedFn(() => {
chunkRequestRef.current?.current?.cancel?.();
listRequestTokenRef.current?.cancel?.();
cacheWatchDataListRef.current = [];
setWatchDataList([]);
});There was a problem hiding this comment.
Pull request overview
This PR moves the MODEL_ROUTE_TARGETS watch lifecycle out of the TableList component and into the deployments page so it can be explicitly started/stopped when the deployments tab becomes active/inactive.
Changes:
- Add
startWatch/cancelWatchcontrols touseWatchListand use them for cleanup. - Start/stop the model-route-targets watcher from
src/pages/llmodels/deployments.tsxas part of the existing “inactive/active” request lifecycle. - Pass the watched
targetListdown into the table component via props (and remove the table’s internal watcher).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/pages/llmodels/deployments.tsx | Owns the model-route-targets watch lifecycle and passes targetList into the table. |
| src/pages/llmodels/components/table-list.tsx | Removes internal useWatchList usage; consumes targetList via props. |
| src/hooks/use-watch-list.ts | Adds cancelWatch and exposes startWatch/cancelWatch in the hook API; uses cancelWatch in unmount cleanup. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.