Keep unassigned task channels in their parent sidebar section

Signed-off-by: John Tennant <jtennant@squareup.com>
This commit is contained in:
John Tennant
2026-09-09 12:45:59 -04:00
parent 7fb8d8f490
commit 9ae8f2a7a5

View File

@@ -318,7 +318,16 @@ export function AppSidebar({
for (const channel of streamChannels) {
if (starredChannelIds?.has(channel.id)) continue;
const sectionId = channelAssignments[channel.id];
let sectionId = channelAssignments[channel.id];
let ancestor = channel.id;
const visited = new Set<string>();
while (!sectionIds.has(sectionId) && !visited.has(ancestor)) {
visited.add(ancestor);
const parent = taskParentByChannelId.get(ancestor);
if (!parent) break;
ancestor = parent;
sectionId = channelAssignments[ancestor];
}
if (sectionId && sectionIds.has(sectionId)) {
if (!bySection[sectionId]) {
bySection[sectionId] = [];
@@ -342,6 +351,7 @@ export function AppSidebar({
};
}, [
streamChannels,
taskParentByChannelId,
channelSections,
channelAssignments,
starredChannelIds,