File tree Expand file tree Collapse file tree 1 file changed +23
-5
lines changed
Expand file tree Collapse file tree 1 file changed +23
-5
lines changed Original file line number Diff line number Diff line change 1- import { Show , createEffect , createSignal , useContext } from "solid-js" ;
1+ import {
2+ Show ,
3+ createEffect ,
4+ createMemo ,
5+ createSignal ,
6+ useContext ,
7+ } from "solid-js" ;
28import MainLayout from "../components/Layouts/MainLayout" ;
39import { Navbar } from "../components/Navbar/Navbar" ;
410import { Sidebar } from "../components/Navbar/Sidebar" ;
@@ -63,6 +69,21 @@ export const Chat = () => {
6369 }
6470 } ) ;
6571
72+ const getOrganizationDatasetLength = createMemo ( ( ) => {
73+ const datasetListOrEmpty = userContext . datasetsAndUsages ?.( ) ?? [ ] ;
74+ const currentOrgId = userContext . currentOrganization ?.( ) ?. id ;
75+
76+ const length = datasetListOrEmpty . filter (
77+ ( item ) => item . dataset . organization_id === currentOrgId ,
78+ ) . length ;
79+
80+ return length ;
81+ } ) ;
82+
83+ const checkDatasetPresent = createMemo ( ( ) => {
84+ return getOrganizationDatasetLength ( ) > 0 ;
85+ } ) ;
86+
6687 return (
6788 < div class = "relative flex h-screen flex-row bg-zinc-100 dark:bg-zinc-900" >
6889 < div class = "hidden w-1/4 overflow-x-hidden lg:block" >
@@ -113,10 +134,7 @@ export const Chat = () => {
113134 orgId = { userContext ?. currentOrganization ?.( ) ?. id }
114135 />
115136 }
116- when = {
117- userContext ?. datasetsAndUsages ?. length &&
118- userContext ?. datasetsAndUsages ?. length <= 0
119- }
137+ when = { checkDatasetPresent ( ) }
120138 >
121139 < MainLayout
122140 setTopics = { setTopics }
You can’t perform that action at this time.
0 commit comments