File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed
frontend/src/components/layout Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff 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 (
You can’t perform that action at this time.
0 commit comments