Repository navigation
Release clipboard previews when the chat composer closes - #26234
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughThe attachment preview hook now tracks mounted state, revokes tracked blob preview URLs on unmount, and revokes URLs passed to Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to No actionable preview-lifecycle issue is established; this change is mergeable after normal checks. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 2📝 Generate docstrings 💡
🛠️ Fix failing CI checks 💡
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 |
ELI5
Pasted chat images release their temporary previews when the composer closes. Saved attachments and pending uploads remain available when you return.
What Changed
The current preview-owner hook revokes its own Blob URLs and clears their retained references on unmount. A preview arriving after that owner closes is released immediately. Shared pending chips, saved paths and connection IDs remain in their existing owners.
Why
Preview ownership has moved out of the attachment hook. Cleanup belongs in the hook that now owns those URLs, which avoids revoking another composer's previews or changing attachment persistence. Retiring late arrivals also prevents an asynchronous save from recreating the leak after unmount.
Linked Issue
N/A — maintainer performance audit.
Visual Proof
Original publication evidence below used the production chat portal, composer and store in a fresh hidden macOS app with controlled save/read calls. It showed restored attachments after switching views. The refreshed ownership implementation was verified with focused lifecycle tests; these screenshots were not re-recorded for this update.
Before:

After:

Testing
Review
Only URLs created for this preview owner are revoked. Unmount leaves shared drafts and pending uploads intact, and development effect replay restores the mounted guard. No negative user-facing trade-off was identified.
Agent skill upstream boundary
Notes
Uses existing browser URL APIs. No path interpretation, main-process routing, remote wire format or mobile behavior changes.
Checklist