Fix topic message search refresh behavior#1847
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughSearch input behavior and filter refresh are refactored to decouple search state changes from URL synchronization. The Search component now accepts a debounceMs prop to control input debouncing, useMessagesFilters centralizes URL and store synchronization via a syncSearchValue helper, and Filters manages search state locally before explicitly passing it to refreshData on refresh. ChangesSearch and Filter Refresh Behavior
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested labelsscope/frontend, type/bug, area/ux Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
There was a problem hiding this comment.
Hi rahulbsw! 👋
Welcome, and thank you for opening your first PR in the repo!
Please wait for triaging by our maintainers.
Please take a look at our contributing guide.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@frontend/src/components/common/Search/Search.tsx`:
- Around line 47-61: The debounced handleChange captures the outer searchParams
and can overwrite concurrent URL updates; update the branch that calls
setSearchParams to use the functional updater form of setSearchParams (instead
of mutating the captured searchParams) so you compute the new URLSearchParams
from the previous state, set 'q' to nextValue and reset 'page' to '1' only if a
page param exists, then return the new params; locate this logic in the
handleChange callback inside the useDebouncedCallback and modify it to derive
and return a fresh URLSearchParams based on the previous params.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d619a9f2-58e2-4f91-88aa-48231730b29d
📒 Files selected for processing (4)
frontend/src/components/Topics/Topic/Messages/Filters/Filters.tsxfrontend/src/components/Topics/Topic/Messages/Filters/__tests__/Filters.spec.tsxfrontend/src/components/common/Search/Search.tsxfrontend/src/lib/hooks/useMessagesFilters.ts
Resolves #999
Summary
Testing
Summary by CodeRabbit
Improvements
Tests