Update recoil v4 states to getters (#3451)
Update v4 states to getters Co-authored-by: Thomas Trompette <thomast@twenty.com>
This commit is contained in:
@ -57,8 +57,8 @@ export const ShowPageRightContainer = ({
|
||||
}: ShowPageRightContainerProps) => {
|
||||
const isMessagingEnabled = useIsFeatureEnabled('IS_MESSAGING_ENABLED');
|
||||
|
||||
const { activeTabIdState } = useTabList(TAB_LIST_COMPONENT_ID);
|
||||
const activeTabId = useRecoilValue(activeTabIdState());
|
||||
const { getActiveTabIdState } = useTabList(TAB_LIST_COMPONENT_ID);
|
||||
const activeTabId = useRecoilValue(getActiveTabIdState());
|
||||
|
||||
const { objectMetadataItem: targetableObjectMetadataItem } =
|
||||
useObjectMetadataItem({
|
||||
|
||||
@ -34,9 +34,9 @@ const StyledContainer = styled.div`
|
||||
export const TabList = ({ tabs, tabListId }: TabListProps) => {
|
||||
const initialActiveTabId = tabs[0].id;
|
||||
|
||||
const { activeTabIdState, setActiveTabId } = useTabList(tabListId);
|
||||
const { getActiveTabIdState, setActiveTabId } = useTabList(tabListId);
|
||||
|
||||
const activeTabId = useRecoilValue(activeTabIdState());
|
||||
const activeTabId = useRecoilValue(getActiveTabIdState());
|
||||
|
||||
React.useEffect(() => {
|
||||
setActiveTabId(initialActiveTabId);
|
||||
|
||||
@ -15,6 +15,6 @@ export const useTabListStates = ({ tabListScopeId }: useTabListStatesProps) => {
|
||||
|
||||
return {
|
||||
scopeId,
|
||||
activeTabIdState: getState(activeTabIdStateScopeMap, scopeId),
|
||||
getActiveTabIdState: getState(activeTabIdStateScopeMap, scopeId),
|
||||
};
|
||||
};
|
||||
|
||||
@ -3,14 +3,14 @@ import { useSetRecoilState } from 'recoil';
|
||||
import { useTabListStates } from '@/ui/layout/tab/hooks/internal/useTabListStates';
|
||||
|
||||
export const useTabList = (tabListId?: string) => {
|
||||
const { activeTabIdState } = useTabListStates({
|
||||
const { getActiveTabIdState } = useTabListStates({
|
||||
tabListScopeId: `${tabListId}-scope`,
|
||||
});
|
||||
|
||||
const setActiveTabId = useSetRecoilState(activeTabIdState());
|
||||
const setActiveTabId = useSetRecoilState(getActiveTabIdState());
|
||||
|
||||
return {
|
||||
activeTabIdState,
|
||||
getActiveTabIdState,
|
||||
setActiveTabId,
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user