[CHORE] Avoid isDefined duplicated reference, move it to twenty-shared (#9967)

# Introduction
Avoid having multiple `isDefined` definition across our pacakges
Also avoid importing `isDefined` from `twenty-ui` which exposes a huge
barrel for a such little util function

## In a nutshell
Removed own `isDefined.ts` definition from `twenty-ui` `twenty-front`
and `twenty-server` to move it to `twenty-shared`.
Updated imports for each packages, and added explicit dependencies to
`twenty-shared` if not already in place

Related PR https://github.com/twentyhq/twenty/pull/9941
This commit is contained in:
Paul Rastoin
2025-02-01 12:10:10 +01:00
committed by GitHub
parent d9b86475d3
commit 7fd89678b7
559 changed files with 731 additions and 770 deletions

View File

@ -11,7 +11,7 @@ import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/
import { useLingui } from '@lingui/react/macro';
import { isNonEmptyString } from '@sniptt/guards';
import { useRecoilValue } from 'recoil';
import { isDefined } from 'twenty-ui';
import { isDefined } from 'twenty-shared';
export type CommandGroupConfig = {
heading: string;

View File

@ -1,7 +1,7 @@
import { useSelectableList } from '@/ui/layout/selectable-list/hooks/useSelectableList';
import { useEffect } from 'react';
import { useRecoilValue } from 'recoil';
import { isDefined } from 'twenty-ui';
import { isDefined } from 'twenty-shared';
export const CommandMenuDefaultSelectionEffect = ({
selectableItemIds,

View File

@ -12,7 +12,8 @@ import { SelectableList } from '@/ui/layout/selectable-list/components/Selectabl
import { AppHotkeyScope } from '@/ui/utilities/hotkey/types/AppHotkeyScope';
import { ScrollWrapper } from '@/ui/utilities/scroll/components/ScrollWrapper';
import styled from '@emotion/styled';
import { MOBILE_VIEWPORT, isDefined } from 'twenty-ui';
import { isDefined } from 'twenty-shared';
import { MOBILE_VIEWPORT } from 'twenty-ui';
const MOBILE_NAVIGATION_BAR_HEIGHT = 64;

View File

@ -4,7 +4,7 @@ import { COMMAND_MENU_PAGES_CONFIG } from '@/command-menu/constants/CommandMenuP
import { commandMenuPageState } from '@/command-menu/states/commandMenuPageState';
import styled from '@emotion/styled';
import { useRecoilValue } from 'recoil';
import { isDefined } from 'twenty-ui';
import { isDefined } from 'twenty-shared';
const StyledCommandMenuContent = styled.div`
flex: 1;

View File

@ -13,7 +13,8 @@ import { useTheme } from '@emotion/react';
import styled from '@emotion/styled';
import { useLingui } from '@lingui/react/macro';
import { useRecoilState, useRecoilValue } from 'recoil';
import { IconX, isDefined, LightIconButton, useIsMobile } from 'twenty-ui';
import { isDefined } from 'twenty-shared';
import { IconX, LightIconButton, useIsMobile } from 'twenty-ui';
const StyledInputContainer = styled.div`
align-items: center;

View File

@ -8,7 +8,8 @@ import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadat
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
import { t } from '@lingui/core/macro';
import { useRecoilValue } from 'recoil';
import { IconArrowBackUp, isDefined } from 'twenty-ui';
import { isDefined } from 'twenty-shared';
import { IconArrowBackUp } from 'twenty-ui';
export const ResetContextToSelectionCommandButton = () => {
const contextStoreTargetedRecordsRule = useRecoilComponentValueV2(

View File

@ -2,7 +2,7 @@ import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu';
import { isNonEmptyString } from '@sniptt/guards';
import { useCallback } from 'react';
import { useNavigate } from 'react-router-dom';
import { isDefined } from 'twenty-ui';
import { isDefined } from 'twenty-shared';
export const useCommandMenuOnItemClick = () => {
const { toggleCommandMenu } = useCommandMenu();