do no animate tabs on load (#351)

This commit is contained in:
Red J Adaya 2024-09-07 08:41:00 +08:00 committed by GitHub
parent 1591a0ca26
commit b278d11aca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -70,6 +70,7 @@ const TabBar = React.memo(({ workspace }: TabBarProps) => {
const tabWidthRef = useRef<number>(TAB_DEFAULT_WIDTH);
const scrollableRef = useRef<boolean>(false);
const updateStatusButtonRef = useRef<HTMLButtonElement>(null);
const prevAllLoadedRef = useRef<boolean>(false);
const windowData = useAtomValue(atoms.waveWindow);
const { activetabid } = windowData;
@ -202,8 +203,11 @@ const TabBar = React.memo(({ workspace }: TabBarProps) => {
// Check if all tabs are loaded
const allLoaded = tabIds.length > 0 && tabIds.every((id) => tabsLoaded[id]);
if (allLoaded) {
updateSizeAndPosition(newTabId === null);
updateSizeAndPosition(newTabId === null && prevAllLoadedRef.current);
saveTabsPosition();
if (!prevAllLoadedRef.current) {
prevAllLoadedRef.current = true;
}
}
}, [tabIds, tabsLoaded, newTabId, handleResizeTabs, saveTabsPosition]);