fix: preserve custom chat widget URL and icon on deselect (NES-1522)#8940
fix: preserve custom chat widget URL and icon on deselect (NES-1522)#8940
Conversation
Use stable React keys on custom ChatOption slots to prevent unmount/remount when the backing button is deleted. Add render-time state reset to sync local state when a different button shifts into the same slot. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
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 (2)
✅ Files skipped from review due to trivial changes (2)
WalkthroughStabilizes React reconciliation for two custom chat slots by using static keys and adds per-instance identity tracking in ChatOption to sync state from a new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 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 |
|
View your CI Pipeline Execution ↗ for commit f99ca7b
☁️ Nx Cloud last updated this comment at |
|
The latest updates on your projects.
|
Summary
keyprop on customChatOptioncomponents changes when the button is deleted, causing React to unmount/remount and destroy localuseStatestate"custom-0","custom-1") to preserve the component instance, plus a render-time state reset to handle the shift case (2 custom buttons where the first is deleted)Changes
Chat.tsxChatOptionslotsChatOption.tsxtrackedIdstate + render-time sync guard to handle button identity changesChatOption.spec.tsxTest plan
Chat.spec.tsx+ChatOption.spec.tsx)Post-Deploy Monitoring & Validation
No additional operational monitoring required: UI-only change scoped to the Chat Widget editor panel. No backend, API, or data model changes.
🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Tests
Documentation