Fixes before 0-35 release (#9176)
Co-authored-by: Weiko <corentin@twenty.com>
This commit is contained in:
@ -1,4 +1,3 @@
|
||||
import { TabListFromUrlOptionalEffect } from '@/ui/layout/tab/components/TabListFromUrlOptionalEffect';
|
||||
import { useTabList } from '@/ui/layout/tab/hooks/useTabList';
|
||||
import { TabListScope } from '@/ui/layout/tab/scopes/TabListScope';
|
||||
import { LayoutCard } from '@/ui/layout/tab/types/LayoutCard';
|
||||
@ -60,10 +59,6 @@ export const TabList = ({
|
||||
|
||||
return (
|
||||
<TabListScope tabListScopeId={tabListInstanceId}>
|
||||
<TabListFromUrlOptionalEffect
|
||||
componentInstanceId={tabListInstanceId}
|
||||
tabListIds={tabs.map((tab) => tab.id)}
|
||||
/>
|
||||
<ScrollWrapper
|
||||
defaultEnableYScroll={false}
|
||||
contextProviderName="tabList"
|
||||
|
||||
@ -1,30 +0,0 @@
|
||||
import { useTabList } from '@/ui/layout/tab/hooks/useTabList';
|
||||
import { useEffect } from 'react';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
|
||||
type TabListFromUrlOptionalEffectProps = {
|
||||
componentInstanceId: string;
|
||||
tabListIds: string[];
|
||||
};
|
||||
|
||||
export const TabListFromUrlOptionalEffect = ({
|
||||
componentInstanceId,
|
||||
tabListIds,
|
||||
}: TabListFromUrlOptionalEffectProps) => {
|
||||
const location = useLocation();
|
||||
const { activeTabId, setActiveTabId } = useTabList(componentInstanceId);
|
||||
|
||||
const hash = location.hash.replace('#', '');
|
||||
|
||||
useEffect(() => {
|
||||
if (hash === activeTabId) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (tabListIds.includes(hash)) {
|
||||
setActiveTabId(hash);
|
||||
}
|
||||
}, [hash, activeTabId, setActiveTabId, tabListIds]);
|
||||
|
||||
return <></>;
|
||||
};
|
||||
Reference in New Issue
Block a user