dengliming opened a new issue, #607:
URL: https://github.com/apache/shenyu-dashboard/issues/607

   ## Description
   `columns` is built with `useMemo(..., [namespaceId, onToggle])` at line 275, 
but `const onToggle` is declared later at line 293. After Babel transpiles 
`const` to `var`, `onToggle` is `undefined` in the dependency array on every 
render, so `columns` is memoized once and the handlers it captures (`onToggle`, 
`fetchList`) keep the first render's `page`, `pageSize`, `queryKey` and 
`selectorId`. If the build ever keeps native `const`, this is a 
`ReferenceError` (temporal dead zone) on every render.
   
   ## Location
   (Lines refer to `master @ 83969a5`.)
   - `src/routes/Plugin/AiProxy/ApiKeys/index.js:275` (dependency array)
   - `src/routes/Plugin/AiProxy/ApiKeys/index.js:293` (declaration of 
`onToggle`)
   
   ## Impact
   Go to page 2 (or apply a filter) and flip an "Enabled" switch: the refetch 
uses page 1 with no filter while the pager still shows page 2, so the table and 
pager disagree.
   
   ## Suggested fix
   Declare `onToggle`/`fetchList` (wrapped in `useCallback`) before the 
`useMemo`, or drop `useMemo` and build `columns` on each render.
   
   ## Related existing
   None
   


-- 
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]

Reply via email to