minor, fix double sub in webview giveFocus#3110
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThe Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (1 file)
The changes correctly fix the double subscription issue by:
Note: CodeRabbit posted a nitpick about making No issues identified. Reviewed by minimax-m2.5-20260211 · 238,532 tokens |
Deploying waveterm with
|
| Latest commit: |
8d5ef8f
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://de24b8c6.waveterm.pages.dev |
| Branch Preview URL: | https://sawka-webview-double-sub.waveterm.pages.dev |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
frontend/app/view/webview/webview.tsx (1)
77-77: Encapsulate the unsubscribe handle with deterministic cleanup.Line 77 exposes
ctrlShiftUnsubFnas a mutable field, and it is only cleared at lines 517–518 whengetSimpleControlShiftAtom()flips tofalse. If the webview unmounts before that state change, the stored callback persists with a closure over the oldWebViewModel, creating a potential memory leak. Hide this handle behind a cleanup method and call it from the existing unmount path (around line 950).🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@frontend/app/view/webview/webview.tsx` at line 77, The public mutable field ctrlShiftUnsubFn on WebViewModel can retain a closure and leak if the component unmounts; make this handle private, add a deterministic cleanup method (e.g., clearCtrlShiftUnsub or disposeCtrlShiftUnsub) that, if the handle is non-null, calls it and sets it to null, and update the code paths that assign ctrlShiftUnsubFn (use a setter that clears any previous handle before storing the new one). Finally call this cleanup method from the existing unmount/teardown path (the WebViewModel/component unmount sequence) and also when getSimpleControlShiftAtom() flips to false so the callback is always removed and nulled.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@frontend/app/view/webview/webview.tsx`:
- Line 77: The public mutable field ctrlShiftUnsubFn on WebViewModel can retain
a closure and leak if the component unmounts; make this handle private, add a
deterministic cleanup method (e.g., clearCtrlShiftUnsub or
disposeCtrlShiftUnsub) that, if the handle is non-null, calls it and sets it to
null, and update the code paths that assign ctrlShiftUnsubFn (use a setter that
clears any previous handle before storing the new one). Finally call this
cleanup method from the existing unmount/teardown path (the
WebViewModel/component unmount sequence) and also when
getSimpleControlShiftAtom() flips to false so the callback is always removed and
nulled.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 452d57ec-994e-43ec-a664-ceb46280e529
📒 Files selected for processing (1)
frontend/app/view/webview/webview.tsx
No description provided.