-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: notification memory leak #361
fix: notification memory leak #361
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Walkthrough此次更改涉及将 Changes
Poem
Recent review detailsConfiguration used: CodeRabbit UI Files selected for processing (1)
Additional comments not posted (3)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #361 +/- ##
=======================================
Coverage 99.73% 99.73%
=======================================
Files 7 7
Lines 759 759
Branches 124 124
=======================================
Hits 757 757
Misses 2 2 ☔ View full report in Codecov by Sentry. |
130行未被用例覆盖 |
@@ -46,7 +46,7 @@ const NoticeList: FC<NoticeListProps> = (props) => { | |||
const { classNames: ctxCls } = useContext(NotificationContext); | |||
|
|||
const dictRef = useRef<Record<string, HTMLDivElement>>({}); | |||
const [latestNotice, setLatestNotice] = useState<HTMLDivElement>(null); | |||
const latestNoticeRef = useRef<HTMLDivElement>(null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
state 换成 ref 在 concurrent 下容易出问题,应该尽量以 effect 里配对做 state 更新。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
另外缺 test case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ref 不会触发更新,会导致样式计算问题
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
那先补下上面说的那些?
Description
当使用stack时 notification会造成内存泄漏
Visuals
修改前的dom节点:
修改后的dom节点:
Checklist
Any TODOs?
A summary of any remaining work required to complete the requirements of the task.
Summary by CodeRabbit