@@ -160,7 +160,6 @@ function setIsEqual(a: Set<string> | null, b: Set<string> | null): boolean {
160160
161161const TabBar = memo ( ( { workspace } : TabBarProps ) => {
162162 const [ tabIds , setTabIds ] = useState < string [ ] > ( [ ] ) ;
163- const [ pinnedTabIds , setPinnedTabIds ] = useState < Set < string > > ( new Set ( ) ) ;
164163 const [ dragStartPositions , setDragStartPositions ] = useState < number [ ] > ( [ ] ) ;
165164 const [ draggingTab , setDraggingTab ] = useState < string > ( ) ;
166165 const [ tabsLoaded , setTabsLoaded ] = useState ( { } ) ;
@@ -209,17 +208,14 @@ const TabBar = memo(({ workspace }: TabBarProps) => {
209208 if ( ! workspace ) {
210209 return ;
211210 }
212- // Compare current tabIds with new workspace.tabids
213- const newTabIdsArr = [ ...( workspace . pinnedtabids ?? [ ] ) , ...( workspace . tabids ?? [ ] ) ] ;
214- const newPinnedTabSet = new Set ( workspace . pinnedtabids ?? [ ] ) ;
211+ const newTabIdsArr = workspace . tabids ?? [ ] ;
215212
216- const areEqual = strArrayIsEqual ( tabIds , newTabIdsArr ) && setIsEqual ( pinnedTabIds , newPinnedTabSet ) ;
213+ const areEqual = strArrayIsEqual ( tabIds , newTabIdsArr ) ;
217214
218215 if ( ! areEqual ) {
219216 setTabIds ( newTabIdsArr ) ;
220- setPinnedTabIds ( newPinnedTabSet ) ;
221217 }
222- } , [ workspace , tabIds , pinnedTabIds ] ) ;
218+ } , [ workspace , tabIds ] ) ;
223219
224220 const saveTabsPosition = useCallback ( ( ) => {
225221 const tabs = tabRefs . current ;
@@ -483,47 +479,17 @@ const TabBar = memo(({ workspace }: TabBarProps) => {
483479 }
484480 } ;
485481
486- // } else if ((tabIndex > pinnedTabCount || (tabIndex === 1 && pinnedTabCount === 1)) && isPinned) {
487-
488482 const setUpdatedTabsDebounced = useCallback (
489- debounce ( 300 , ( tabIndex : number , tabIds : string [ ] , pinnedTabIds : Set < string > ) => {
490- console . log (
491- "setting updated tabs" ,
492- tabIds ,
493- pinnedTabIds ,
494- tabIndex ,
495- draggingTabDataRef . current . tabStartIndex
496- ) ;
483+ debounce ( 300 , ( tabIds : string [ ] ) => {
497484 // Reset styles
498485 tabRefs . current . forEach ( ( ref ) => {
499486 ref . current . style . zIndex = "0" ;
500487 ref . current . classList . remove ( "animate" ) ;
501488 } ) ;
502- let pinnedTabCount = pinnedTabIds . size ;
503- const draggedTabId = draggingTabDataRef . current . tabId ;
504- const isPinned = pinnedTabIds . has ( draggedTabId ) ;
505- const nextTabId = tabIds [ tabIndex + 1 ] ;
506- const prevTabId = tabIds [ tabIndex - 1 ] ;
507- if ( ! isPinned && nextTabId && pinnedTabIds . has ( nextTabId ) ) {
508- pinnedTabIds . add ( draggedTabId ) ;
509- } else if ( isPinned && prevTabId && ! pinnedTabIds . has ( prevTabId ) ) {
510- pinnedTabIds . delete ( draggedTabId ) ;
511- }
512- if ( pinnedTabCount != pinnedTabIds . size ) {
513- console . log ( "updated pinnedTabIds" , pinnedTabIds , tabIds ) ;
514- setPinnedTabIds ( pinnedTabIds ) ;
515- pinnedTabCount = pinnedTabIds . size ;
516- }
517489 // Reset dragging state
518490 setDraggingTab ( null ) ;
519491 // Update workspace tab ids
520- fireAndForget ( ( ) =>
521- WorkspaceService . UpdateTabIds (
522- workspace . oid ,
523- tabIds . slice ( pinnedTabCount ) ,
524- tabIds . slice ( 0 , pinnedTabCount )
525- )
526- ) ;
492+ fireAndForget ( ( ) => WorkspaceService . UpdateTabIds ( workspace . oid , tabIds ) ) ;
527493 } ) ,
528494 [ ]
529495 ) ;
@@ -542,7 +508,7 @@ const TabBar = memo(({ workspace }: TabBarProps) => {
542508 }
543509
544510 if ( dragged ) {
545- setUpdatedTabsDebounced ( tabIndex , tabIds , pinnedTabIds ) ;
511+ setUpdatedTabsDebounced ( tabIds ) ;
546512 } else {
547513 // Reset styles
548514 tabRefs . current . forEach ( ( ref ) => {
@@ -626,14 +592,6 @@ const TabBar = memo(({ workspace }: TabBarProps) => {
626592 deleteLayoutModelForTab ( tabId ) ;
627593 } ;
628594
629- const handlePinChange = useCallback (
630- ( tabId : string , pinned : boolean ) => {
631- console . log ( "handlePinChange" , tabId , pinned ) ;
632- fireAndForget ( ( ) => WorkspaceService . ChangeTabPinning ( workspace . oid , tabId , pinned ) ) ;
633- } ,
634- [ workspace ]
635- ) ;
636-
637595 const handleTabLoaded = useCallback ( ( tabId : string ) => {
638596 setTabsLoaded ( ( prev ) => {
639597 if ( ! prev [ tabId ] ) {
@@ -703,20 +661,17 @@ const TabBar = memo(({ workspace }: TabBarProps) => {
703661 < div className = "tab-bar" ref = { tabBarRef } data-overlayscrollbars-initialize >
704662 < div className = "tabs-wrapper" ref = { tabsWrapperRef } style = { { width : `${ tabsWrapperWidth } px` } } >
705663 { tabIds . map ( ( tabId , index ) => {
706- const isPinned = pinnedTabIds . has ( tabId ) ;
707664 return (
708665 < Tab
709666 key = { tabId }
710667 ref = { tabRefs . current [ index ] }
711668 id = { tabId }
712669 isFirst = { index === 0 }
713- isPinned = { isPinned }
714670 onSelect = { ( ) => handleSelectTab ( tabId ) }
715671 active = { activeTabId === tabId }
716672 onDragStart = { ( event ) => handleDragStart ( event , tabId , tabRefs . current [ index ] ) }
717673 onClose = { ( event ) => handleCloseTab ( event , tabId ) }
718674 onLoaded = { ( ) => handleTabLoaded ( tabId ) }
719- onPinChange = { ( ) => handlePinChange ( tabId , ! isPinned ) }
720675 isBeforeActive = { isBeforeActive ( tabId ) }
721676 isDragging = { draggingTab === tabId }
722677 tabWidth = { tabWidthRef . current }
0 commit comments