Repository navigation
修复第 4 轮(工程质量·前端):i18n、组件抽取、类型归一化与 Low 级前端问题 - #123
Merged
todosdev[bot] merged 2 commits intoOct 18, 2026
Merged
Conversation
added 2 commits
October 18, 2026 00:24
- FE-Q1: move hardcoded toast copy to i18n with matching en/zh-CN keys. - FE-Q2: extract shared ConfirmDialog and a RESEND_COUNTDOWN_SECONDS constant. - FE-Q3: normalize SQLite 0/1 flags to booleans in the API client and update types/usages. - FE-R4: retry queries only on transport/5xx errors and debounce list search by 300ms. - FE-R5: keep ?next= through expiry and login (same-origin paths only) and surface clipboard failures. - FE-C5: minutes for sub-hour expiry plus unit validation, disable admin controls while mutating, sync analytics params with history, count down from an absolute deadline. - #6: emit the session-expired toast once per expiry instead of once per request. - BE-Q2 (web): cover refresh outcomes, cross-tab locking and dedup with node:test. Checkpoint: rOmcynJUsp5cIiDIEfUC5
- FE-R4: classify transport failures as NetworkError and retry only those and 5xx; JSON parse and other program errors no longer retry, with negative tests. - FE-C5: disable a user's role/status/delete controls whenever any of that user's mutations is pending. - BE-Q2: verify the cross-tab Web Locks serialization with a shared mutex stub and two separate client module instances. Checkpoint: 7i4Ry-7qNjOLOsheocbOk
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
0/1布尔在 API client 层归一化、列表搜索 300ms 防抖、react-query 重试收窄到网络错误/5xx。?next=回跳(仅站内相对路径,防开放重定向)、剪贴板失败提示、会话过期提示只弹一次。node --test单测(零新增依赖)。Changes
API client(
src/api/client.ts)ApiRequestError(带 status)、NetworkError、SessionExpiredError错误分类;isRetryableError只对网络错误与 5xx 返回 true。WireUser/WireLink+normalizeUser/normalizeLink在 client 边界把 SQLite0/1布尔转成boolean,User/Link类型同步更新。transient/网络失败抛NetworkError。i18n(
src/i18n/locales/en.ts、zh-CN.ts,src/lib/toast.ts)toast文案组(中英各 36 条)与links.*Remaining过期标签;toastApiError统一错误 toast 并吞掉会话过期错误,避免按请求重复提示。组件与 hooks
components/confirm-dialog.tsx公共删除确认框,替换链接列表 / 管理员链接 / 管理员用户三处。hooks/use-debounced-value.ts、lib/constants.ts(RESEND_COUNTDOWN_SECONDS、SEARCH_DEBOUNCE_MS)。use-countdown改为按绝对截止时间计算,后台标签页节流后不漂移。页面
LinksPage/AdminLinksPage/AdminUsersPage/AnalyticsPage:搜索框 300ms 防抖。App.tsx+LoginPage/TwoFactorPage:会话过期与登录链路透传?next=(safeNextPath白名单校验站内相对路径)。AnalyticsPage:linkId/days由 URL 派生,前进/后退同步。AdminUsersPage:任一 mutation 进行中,该用户的角色/状态/删除控件全部禁用。link-table-cells.tsx:过期显示分钟级标签,复制失败弹 toast。测试(
src/api/client.test.ts、src/lib/utils.test.ts,package.json加test脚本)next白名单。Testing
pnpm install --frozen-lockfile、pnpm check、pnpm typecheck、pnpm build全部通过;pnpm test25/25。next跳转、会话过期回跳?next=且提示只弹一次、//evil.example开放重定向被拒、中文界面 toast 与「剩余 30 分钟」标签。全程无未捕获异常。