-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix(webview): resolve memory leak in ChatView by stabilizing callback props #3926
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
Conversation
Hey, Reviewed the memory implications of this refactor. While the performance improvements are solid, there are a few memory concerns we should address: Main Issue: The Recommended fixes:
The other refs are fine - minimal overhead and good for performance. But definitely think we should address the growing Set before this possibly gets merged. In the end our issue is memory, and this does increase memory usage currently resulting in a backwards approach |
c5193cc
to
aa5b66a
Compare
@xyOz-dev is it look good to you ? |
i don't understand the 2. Inline expand handlers
and
it not the same thing, handleExpand still take an params is ts, but onToggleExpand on ToolRow is not take anything params |
aa5b66a
to
a6ab318
Compare
@daniel-lxs @xyOz-dev updated !, can you guys pls check again |
a6ab318
to
bc9dbf2
Compare
0fff7ec
to
9982641
Compare
… props - Stabilize handleSendMessage using clineAskRef to prevent frequent re-creation - Stabilize toggleRowExpansion by extracting handleSetExpandedRow and managing dependencies - Re-integrate scrolling logic into useEffect hook to avoid destabilizing callbacks - Add everVisibleMessagesTsRef to reduce unnecessary ChatRow remounts by Virtuoso - Update onToggleExpand signature to accept timestamp parameter for better stability - Remove diagnostic console.log statements used for debugging callback changes These changes address detached DOM elements memory leak caused by frequent callback re-creation triggering unnecessary component re-renders and preventing proper garbage collection of chat message DOM nodes.
9982641
to
abed6dc
Compare
@mrubens @xyOz-dev @daniel-lxs updated ! |
LGTM, all the feedback was addressed properly. |
Related GitHub Issue
This will related to grey screen issues which cause by webview memory leak
Closes: #3927
Description
These changes address detached DOM elements memory leak caused by frequent callback re-creation triggering unnecessary component re-renders and preventing proper garbage collection of chat message DOM nodes.
Test Procedure
Type of Change
src
or test files.Pre-Submission Checklist
npm run lint
).console.log
) has been removed.npm test
).main
branch.npm run changeset
if this PR includes user-facing changes or dependency updates.Screenshots / Videos
Documentation Updates
Additional Notes
Get in Touch
Important
Fix memory leak in ChatView by stabilizing callback props and optimizing component re-renders.
handleSendMessage
usingclineAskRef
inChatView.tsx
to prevent frequent re-creation.toggleRowExpansion
by extractinghandleSetExpandedRow
and managing dependencies inChatView.tsx
.useEffect
hook inChatView.tsx
to avoid destabilizing callbacks.everVisibleMessagesTsRef
inChatView.tsx
to reduce unnecessaryChatRow
remounts byVirtuoso
.onToggleExpand
signature inChatRow.tsx
to accept timestamp parameter for better stability.console.log
statements used for debugging callback changes.This description was created by
for c5193cc. You can customize this summary. It will automatically update as commits are pushed.