-
Notifications
You must be signed in to change notification settings - Fork 13.1k
regression: Select sidepanel filter when navigating to room #36808
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
|
Looks like this PR is ready to merge! 🎉 |
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## release-7.10.0 #36808 +/- ##
=================================================
Coverage ? 64.87%
=================================================
Files ? 3251
Lines ? 109452
Branches ? 20674
=================================================
Hits ? 71002
Misses ? 35924
Partials ? 2526
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
…arked as the principal/first item
…nused hook - Added `useLocalStorage` to manage side panel filter state. - Updated `useSidePanelFilter` to return the current filter, unread status, and a setter function. - Removed the unused `useSidePanelFilters` hook. - Adjusted `RoomsNavigationProvider` to utilize the new filter management approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This regression fix addresses an issue where the side panel filter selection was not being properly maintained when navigating to rooms. The PR reorganizes the layout structure and implements automatic filter selection based on the room type when opening rooms.
- Refactors layout component structure to move sidebar components within feature preview sections
- Adds automatic room-based filter selection logic that triggers when a room is opened
- Consolidates filter management by removing
useSidePanelFiltershook and integrating functionality into context
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| LayoutWithSidebarV2.tsx | Restructures component layout to move MainLayoutStyleTags and sidebar components within feature preview sections |
| useChannelsChildrenList.ts | Updates main room sorting logic to handle team-based filtering scenarios |
| SidebarItemWithData.tsx | Simplifies room click handling by replacing custom logic with new useRedirectToFilter hook |
| RoomsNavigationProvider.tsx | Adds room opening event listener and automatic filter selection logic based on room types |
| useSidePanelFilters.ts | Removes entire file as functionality is moved to context |
| RoomsNavigationContext.ts | Consolidates filter management and adds useRedirectToFilter hook for room navigation |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| } | ||
|
|
||
| if (room.teamId && currentFilter === 'teams') { | ||
| const teamRid = Rooms.use.getState().find((r) => Boolean(r.teamId === room.teamId && r.teamMain))?._id; |
Copilot
AI
Aug 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code performs a linear search through all rooms on every room open event. Consider optimizing this by creating an index or using a more efficient lookup method, especially if the rooms collection is large.
| } | ||
|
|
||
| if (room.prid) { | ||
| const prid = Rooms.use.getState().find((r) => Boolean(r._id === room.prid))?._id; |
Copilot
AI
Aug 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another linear search through the rooms collection. Since you're looking up by _id (which should be unique), consider using a more efficient lookup method or indexing strategy.
| switchSidePanelTab('directMessages', { parentRid: roomId }); | ||
| return; | ||
| } | ||
|
|
Copilot
AI
Aug 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fallback logic room.prid || roomId could be confusing. Consider adding a comment explaining when room.prid would be undefined and why roomId is the appropriate fallback.
Proposed changes (including videos or screenshots)
Important
This change is under feature preview
Introduced here: #36049
Issue(s)
Steps to test or reproduce
Further comments
SIDE2-148