Repository navigation
fix: conditionally render room archived warning in room information - #1404
Conversation
| const channelInfo = useChannelStore((state) => state.channelInfo); | ||
| const isChannelPrivate = useChannelStore((state) => state.isChannelPrivate); | ||
| const isRoomTeam = useChannelStore((state) => state.isRoomTeam); | ||
| const isChannelArchived = useChannelStore((state) => state.isChannelArchived); |
There was a problem hiding this comment.
Does this store already exist and manage it internally?
There was a problem hiding this comment.
Yes, exactly! useChannelStore (packages/react/src/store/channelStore.js) already defines isChannelArchived: false and setIsChannelArchived.
In ChatHeader.js (lines 95–96 & 297), when the room returns an error-room-archived response, it calls setIsChannelArchived(true) and stores the room metadata in channelInfo.
Previously, RoomInformation.js subscribed to channelInfo, isChannelPrivate, and isRoomTeam from useChannelStore, but isChannelArchived was missing and the warning banner was rendered unconditionally for every room. This fix simply connects the existing store property and room metadata (channelInfo?.archived || isChannelArchived) to conditionally render the banner as originally intended.
There was a problem hiding this comment.
Thank you for reviewing and approving @Spiral-Memory! Really appreciate the feedback. 🙌
Looking forward to the merge whenever you get a chance @Aryan-Verma-999!
|
@Aryan-Verma-999 Feel free to merge if looks good to you |
|
Hi @Aryan-Verma-999 @Spiral-Memory, hope you're both doing well! Just wanted to gently check in on this PR to see if any further changes or checks are needed on my end before merging, or if everything is good to go. Happy to make any adjustments if needed! Thanks again for your time! |
Summary
Closes #1109.
Fixes an issue where the Room Information sidebar unconditionally displayed the "Room Archived" warning banner across all channels, regardless of their actual archived status.
Problem (Before)
In
packages/react/src/views/RoomInformation/RoomInformation.js: