fix(ui): 清理卸载后的延迟状态更新#93
Merged
Merged
Conversation
Store the remaining transient UI timeout handles in refs so Settings About copy feedback and Onboarding delayed permission refresh do not call setState after their components unmount. Constraint: Issue Open-Less#64 asks for minimal setTimeout handle cleanup without changing UI behavior Confidence: high Scope-risk: narrow Tested: npm run build Tested: git diff --check
There was a problem hiding this comment.
Sorry @H-Chris233, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
Collaborator
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. Chef's kiss. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
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.
摘要
Fixes #64。
本 PR 按最小改动修复前端部分
setTimeout未保存 handle,导致组件卸载后仍可能执行状态更新的问题。此前
AboutSection的qqCopied闪烁 timeout,以及Onboarding中 refresh 延后 timeout,未统一保存并在组件卸载时清理。React 18 strict mode 下可能出现组件卸载后setState的控制台警告,长时间使用也存在轻微泄漏风险。本次改动将相关 timeout handle 改为通过
useRef保存,并在组件卸载时执行clearTimeout。重复触发时也会先清理旧 timeout,避免多个延迟回调叠加。修复 / 新增 / 改进
修复
Settings.tsx中AboutSection的qqCopied闪烁 timeout:useRef保存 timeout handleclearTimeout修复
Onboarding.tsx中 refresh 延后 timeout:useRef保存 timeout handleclearTimeout保持现有 UI 行为不变:
CredentialField相关 timeout 远端已有 ref / cleanup 处理,本 PR 未重复修改。兼容
不包含:
对现有用户 / 本地环境 / 构建流程的影响:
测试计划
命令:
npm run build结果:通过
证据路径:本地构建输出
命令:
git diff --check结果:通过
证据路径:本地命令输出
主要改动文件
openless-all/app/src/pages/Settings.tsxopenless-all/app/src/components/Onboarding.tsx备注
本 PR 仅处理当前仍缺少 timeout cleanup 的位置。
CredentialField相关 timeout 远端已有 ref / cleanup 处理,因此未在本次最小修复中重复改动。