Skip to content

fix(console): declare account modal loader dependencies - #651

Merged
caigee-cmd merged 2 commits into
caigee-cmd:mainfrom
guyu233:fix/console-modal-effect-deps
Dec 4, 2026
Merged

caigee-cmd merged 2 commits into
caigee-cmd:mainfrom
guyu233:fix/console-modal-effect-deps

Conversation

@guyu233

@guyu233 guyu233 commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Problem

  • The check-in records and account models modals called a plain load() from a useEffect and listed only [accountId]; any future loader input would silently read a stale closure.
  • The models modal captured pageSize in the effect while the loader signature took it from state, so changing the page size could refetch or reset the requested size inconsistently.

Change

  • Wrap both loaders in useCallback and add them to the effect dependencies.
  • Keep the models pagination size in a ref so the effect does not refetch when the page size changes, while the loader still uses the latest size.
  • Annotate the intentional every-render effects in AgentQueue / OverviewPage and enable react/exhaustive-deps (plus the related opt-outs) in .oxlintrc.json.
  • Regenerate internal/webui/static with npm run sync.

Validation

  • cd frontend && npm run lint (0 errors)
  • cd frontend && npm run sync
  • git diff --check

Wrap the check-in records and models loaders in useCallback, keep the models pagination size in a ref so changing it does not refetch, and annotate the intentional every-render effects so the new exhaustive-deps rule stays clean. Embedded console assets are regenerated with npm run sync.

@caigee-cmd caigee-cmd left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已审:真正的逻辑改动只有两个账号弹窗的 loader 改成 useCallback、模型弹窗用 ref 保存最新 pageSize,加上 3 处注释说明。其余 37 个文件是重新构建的嵌入资源,本地 npm run sync 后工作区无差异,资源和源码一致。

一个需要留意的点:.oxlintrc.json 在打开 react/exhaustive-deps 的同时,把 oxlint 默认开启的 react/refs、react/purity、react/set-state-in-effect 三条规则关掉了。main 上这三条目前分别有 90 / 5 / 21 条 warning,这个 PR 之后就看不到了;另外新加的 pageSizeRef.current = pageSize(渲染期间写 ref)本来也会被 react/refs 报出来。建议后续只在需要的地方单独 disable,把这三条恢复。可以合。

@caigee-cmd
caigee-cmd merged commit 60998b1 into caigee-cmd:main Dec 4, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants