@@ -167,7 +167,7 @@ function OrganizationSearchContent({ userId, chatId }: OrganizationSearchProps)
167167 const { recordQuery } = useSearchHistoryActions ( )
168168 const router = useRouter ( )
169169 const pathname = usePathname ( )
170- const hasSearchParams = useSearchParams ( ) . size > 0
170+ const hasSearchParams = useSearchParams ( ) . toString ( ) !== ''
171171 const routes = organizationRoutes ( organization . id )
172172 const hasConversation = Boolean ( chatId ) || pathname . startsWith ( `${ routes . search } /chat/` )
173173 const queryClient = useQueryClient ( )
@@ -187,11 +187,7 @@ function OrganizationSearchContent({ userId, chatId }: OrganizationSearchProps)
187187 [ ]
188188 )
189189 useEffect ( ( ) => {
190- if ( ! mothershipAvailable ) return
191- if ( routeMode ) {
192- BrowserStorage . setItem ( preferenceKey , routeMode )
193- return
194- }
190+ if ( ! mothershipAvailable || routeMode ) return
195191 const savedMode = BrowserStorage . getItem < unknown > ( preferenceKey , null )
196192 // Pin the mode to this history entry so Back survives a later preference change.
197193 void setParams ( { mode : savedMode === 'assistant' ? 'assistant' : 'search' } )
@@ -200,6 +196,7 @@ function OrganizationSearchContent({ userId, chatId }: OrganizationSearchProps)
200196 if ( activeMode === 'assistant' && ! assistantOpened ) setAssistantOpened ( true )
201197
202198 const changeMode = ( next : 'search' | 'assistant' ) => {
199+ BrowserStorage . setItem ( preferenceKey , next )
203200 void setParams ( { mode : next } , { history : 'push' } )
204201 }
205202 const startNew = ( ) => {
0 commit comments