Skip to content

Commit 749826d

Browse files
committed
tweaks
1 parent 2e41f53 commit 749826d

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

frontend/src/components/layout/sidebar.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,18 @@ export const Sidebar = () => {
112112
</Button>
113113
);
114114

115-
const projectIdToChats = chats.reduce((acc, chat) => {
116-
const projectId = chat.project?.id;
117-
if (!acc[projectId]) {
118-
acc[projectId] = [];
119-
}
120-
acc[projectId].push(chat);
121-
return acc;
122-
}, {});
115+
const projectIdToChats = chats
116+
.filter(
117+
(chat) => chat.project && projects.some((p) => p.id === chat.project.id)
118+
)
119+
.reduce((acc, chat) => {
120+
const projectId = chat.project.id;
121+
if (!acc[projectId]) {
122+
acc[projectId] = [];
123+
}
124+
acc[projectId].push(chat);
125+
return acc;
126+
}, {});
123127
const sortedProjectIdToChats = Object.entries(projectIdToChats).sort(
124128
([projectIdA], [projectIdB]) => {
125129
return (

0 commit comments

Comments
 (0)