Skip to content

Commit ae66de8

Browse files
fix(handleMemberUpdated): consider both pinned and archived channels (#2638)
### 🎯 Goal This PR solves an issue where if `pinned_at` is missing from the `sort`, the archived channels are not being handled properly during application runtime.
1 parent ed0906c commit ae66de8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/components/ChannelList/hooks/useChannelListShape.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,11 @@ export const useChannelListShapeDefaults = <SCG extends ExtendableGenerics>() =>
285285
const considerPinnedChannels = shouldConsiderPinnedChannels(sort);
286286
const considerArchivedChannels = shouldConsiderArchivedChannels(filters);
287287

288+
// `pinned_at` nor `archived` properties are set or channel list order is locked, return early
289+
if ((!considerPinnedChannels && !considerArchivedChannels) || lockChannelOrder) {
290+
return;
291+
}
292+
288293
const pinnedAtSort = extractSortValue({ atIndex: 0, sort, targetKey: 'pinned_at' });
289294

290295
setChannels((currentChannels) => {
@@ -296,9 +301,6 @@ export const useChannelListShapeDefaults = <SCG extends ExtendableGenerics>() =>
296301
const isTargetChannelArchived = isChannelArchived(targetChannel);
297302
const isTargetChannelPinned = isChannelPinned(targetChannel);
298303

299-
// handle pinning
300-
if (!considerPinnedChannels || lockChannelOrder) return currentChannels;
301-
302304
const newChannels = [...currentChannels];
303305

304306
if (targetChannelExistsWithinList) {

0 commit comments

Comments
 (0)