@@ -22,7 +22,6 @@ import { themeBgAppChatComposer } from '~/common/app.theme';
22
22
import { useFolderStore } from '~/common/state/store-folders' ;
23
23
import { useIsMobile } from '~/common/components/useMatchMedia' ;
24
24
import { useOptimaLayout , usePluggableOptimaLayout } from '~/common/layout/optima/useOptimaLayout' ;
25
- import { useUXLabsStore } from '~/common/state/store-ux-labs' ;
26
25
27
26
import type { ComposerOutputMultiPart } from './components/composer/composer.types' ;
28
27
import { ChatDrawerMemo } from './components/applayout/ChatDrawer' ;
@@ -311,24 +310,23 @@ export function AppChat() {
311
310
const handleConversationBranch = React . useCallback ( ( conversationId : DConversationId , messageId : string | null ) : DConversationId | null => {
312
311
showNextTitle . current = true ;
313
312
const branchedConversationId = branchConversation ( conversationId , messageId ) ;
313
+ if ( isSplitPane )
314
+ openSplitConversationId ( branchedConversationId ) ;
315
+ else
316
+ setFocusedConversationId ( branchedConversationId ) ;
314
317
addSnackbar ( {
315
318
key : 'branch-conversation' ,
316
319
message : 'Branch started.' ,
317
320
type : 'success' ,
318
321
overrides : {
319
- autoHideDuration : 3000 ,
322
+ autoHideDuration : 2000 ,
320
323
startDecorator : < ForkRightIcon /> ,
321
324
} ,
322
325
} ) ;
323
- const branchInAltPanel = useUXLabsStore . getState ( ) . labsSplitBranching ;
324
- if ( branchInAltPanel )
325
- openSplitConversationId ( branchedConversationId ) ;
326
- else
327
- setFocusedConversationId ( branchedConversationId ) ;
328
326
return branchedConversationId ;
329
- } , [ branchConversation , openSplitConversationId , setFocusedConversationId ] ) ;
327
+ } , [ branchConversation , isSplitPane , openSplitConversationId , setFocusedConversationId ] ) ;
330
328
331
- const handleConversationFlatten = ( conversationId : DConversationId ) => setFlattenConversationId ( conversationId ) ;
329
+ const handleConversationFlatten = React . useCallback ( ( conversationId : DConversationId ) => setFlattenConversationId ( conversationId ) , [ ] ) ;
332
330
333
331
const handleConfirmedClearConversation = React . useCallback ( ( ) => {
334
332
if ( clearConversationId ) {
@@ -386,10 +384,8 @@ export function AppChat() {
386
384
const centerItems = React . useMemo ( ( ) =>
387
385
< ChatDropdowns
388
386
conversationId = { focusedConversationId }
389
- isSplitPanes = { isSplitPane }
390
- onToggleSplitPanes = { toggleSplitPane }
391
387
/> ,
392
- [ focusedConversationId , isSplitPane , toggleSplitPane ] ,
388
+ [ focusedConversationId ] ,
393
389
) ;
394
390
395
391
const drawerContent = React . useMemo ( ( ) =>
@@ -410,16 +406,19 @@ export function AppChat() {
410
406
411
407
const menuItems = React . useMemo ( ( ) =>
412
408
< ChatMenuItems
409
+ isMobile = { isMobile }
413
410
conversationId = { focusedConversationId }
414
411
hasConversations = { ! areChatsEmpty }
415
412
isConversationEmpty = { isFocusedChatEmpty }
416
413
isMessageSelectionMode = { isMessageSelectionMode }
414
+ isSplitPane = { isSplitPane }
417
415
setIsMessageSelectionMode = { setIsMessageSelectionMode }
418
416
onConversationBranch = { handleConversationBranch }
419
417
onConversationClear = { handleConversationClear }
420
418
onConversationFlatten = { handleConversationFlatten }
419
+ onToggleSplitPanes = { toggleSplitPane }
421
420
/> ,
422
- [ areChatsEmpty , focusedConversationId , handleConversationBranch , handleConversationClear , isFocusedChatEmpty , isMessageSelectionMode ] ,
421
+ [ areChatsEmpty , focusedConversationId , handleConversationBranch , handleConversationClear , handleConversationFlatten , isFocusedChatEmpty , isMessageSelectionMode , isMobile , isSplitPane , toggleSplitPane ] ,
423
422
) ;
424
423
425
424
usePluggableOptimaLayout ( drawerContent , centerItems , menuItems , 'AppChat' ) ;
0 commit comments