Rename Jotai state hooks and utilities to consistent Atom-based naming (#18209)
## Summary Rename all Jotai-based state management hooks and utilities to a consistent naming convention that: 1. Removes legacy Recoil naming (`useRecoilXxxV2`, `createXxxV2`) 2. Always includes `Atom` in the name to distinguish from jotai native hooks 3. Follows a consistent ordering: `Atom` → `Component` → `Family` → `Type` (`State`/`Selector`) 4. Includes the type qualifier (`State` or `Selector`) in all value-reading hooks to avoid naming conflicts with jotai's native `useAtomValue` ## Naming Convention **Hooks**: `use[Set]Atom[Component][Family][State|Selector][Value|State|CallbackState]` **Utils**: `createAtom[Component][Family][State|Selector]` ## Changes ### Hooks renamed (definition files + all usages across ~1,500 files): | Old Name (Recoil) | Intermediate (Atom) | Final Name | |---|---|---| | `useRecoilValueV2` | `useAtomValue` | **`useAtomStateValue`** | | `useRecoilStateV2` | `useAtomState` | `useAtomState` | | `useSetRecoilStateV2` | `useSetAtomState` | `useSetAtomState` | | `useFamilyRecoilValueV2` | `useFamilyAtomValue` | **`useAtomFamilyStateValue`** | | `useSetFamilyRecoilStateV2` | `useSetFamilyAtomState` | **`useSetAtomFamilyState`** | | `useFamilySelectorValueV2` | `useFamilySelectorValue` | **`useAtomFamilySelectorValue`** | | `useFamilySelectorStateV2` | `useFamilySelectorState` | **`useAtomFamilySelectorState`** | | `useRecoilComponentValueV2` | `useAtomComponentValue` | **`useAtomComponentStateValue`** | | `useRecoilComponentStateV2` | `useAtomComponentState` | `useAtomComponentState` | | `useSetRecoilComponentStateV2` | `useSetAtomComponentState` | `useSetAtomComponentState` | | `useRecoilComponentFamilyValueV2` | `useAtomComponentFamilyValue` | **`useAtomComponentFamilyStateValue`** | | `useRecoilComponentFamilyStateV2` | `useAtomComponentFamilyState` | `useAtomComponentFamilyState` | | `useSetRecoilComponentFamilyStateV2` | `useSetAtomComponentFamilyState` | `useSetAtomComponentFamilyState` | | `useRecoilComponentSelectorValueV2` | `useAtomComponentSelectorValue` | `useAtomComponentSelectorValue` | | `useRecoilComponentFamilySelectorValueV2` | `useAtomComponentFamilySelectorValue` | `useAtomComponentFamilySelectorValue` | | `useRecoilComponentStateCallbackStateV2` | `useAtomComponentStateCallbackState` | `useAtomComponentStateCallbackState` | | `useRecoilComponentSelectorCallbackStateV2` | `useAtomComponentSelectorCallbackState` | `useAtomComponentSelectorCallbackState` | | `useRecoilComponentFamilyStateCallbackStateV2` | `useAtomComponentFamilyStateCallbackState` | `useAtomComponentFamilyStateCallbackState` | | `useRecoilComponentFamilySelectorCallbackStateV2` | `useAtomComponentFamilySelectorCallbackState` | `useAtomComponentFamilySelectorCallbackState` | ### Utilities renamed: | Old Name (Recoil) | Final Name | |---|---| | `createStateV2` | **`createAtomState`** | | `createFamilyStateV2` | **`createAtomFamilyState`** | | `createSelectorV2` | **`createAtomSelector`** | | `createFamilySelectorV2` | **`createAtomFamilySelector`** | | `createWritableSelectorV2` | **`createAtomWritableSelector`** | | `createWritableFamilySelectorV2` | **`createAtomWritableFamilySelector`** | | `createComponentStateV2` | **`createAtomComponentState`** | | `createComponentFamilyStateV2` | **`createAtomComponentFamilyState`** | | `createComponentSelectorV2` | **`createAtomComponentSelector`** | | `createComponentFamilySelectorV2` | **`createAtomComponentFamilySelector`** | ## Details - All definition files renamed to match new convention - All import paths and usages updated across the entire `twenty-front` package - Jotai's native `useAtomValue` is aliased as `useJotaiAtomValue` in the wrapper hook to avoid collision - Legacy Recoil files in `state/utils/` and `component-state/utils/` left untouched (separate naming scope) - Typecheck passes cleanly
This commit is contained in:
+3
-3
@@ -3,7 +3,7 @@ import { useDefaultHomePagePath } from '@/navigation/hooks/useDefaultHomePagePat
|
||||
import { useOnboardingStatus } from '@/onboarding/hooks/useOnboardingStatus';
|
||||
import { useIsWorkspaceActivationStatusEqualsTo } from '@/workspace/hooks/useIsWorkspaceActivationStatusEqualsTo';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2';
|
||||
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
|
||||
import { AppPath, SettingsPath } from 'twenty-shared/types';
|
||||
import { getSettingsPath } from 'twenty-shared/utils';
|
||||
|
||||
@@ -63,14 +63,14 @@ const setupMockUseParams = (objectNamePlural?: string) => {
|
||||
.mockReturnValueOnce({ objectNamePlural: objectNamePlural ?? '' });
|
||||
};
|
||||
|
||||
jest.mock('@/ui/utilities/state/jotai/hooks/useRecoilValueV2');
|
||||
jest.mock('@/ui/utilities/state/jotai/hooks/useAtomStateValue');
|
||||
const setupMockRecoil = (
|
||||
objectNamePlural?: string,
|
||||
verifyEmailRedirectPath?: string,
|
||||
calendarBookingPageId?: string | null,
|
||||
) => {
|
||||
jest
|
||||
.mocked(useRecoilValueV2)
|
||||
.mocked(useAtomStateValue)
|
||||
.mockReturnValueOnce(calendarBookingPageId ?? 'mock-calendar-id')
|
||||
.mockReturnValueOnce([{ namePlural: objectNamePlural ?? '' }])
|
||||
.mockReturnValueOnce(verifyEmailRedirectPath);
|
||||
|
||||
@@ -5,7 +5,7 @@ import { useIsCurrentLocationOnAWorkspace } from '@/domain-manager/hooks/useIsCu
|
||||
import { useDefaultHomePagePath } from '@/navigation/hooks/useDefaultHomePagePath';
|
||||
import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState';
|
||||
import { useOnboardingStatus } from '@/onboarding/hooks/useOnboardingStatus';
|
||||
import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2';
|
||||
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
|
||||
import { useIsWorkspaceActivationStatusEqualsTo } from '@/workspace/hooks/useIsWorkspaceActivationStatusEqualsTo';
|
||||
import { useLocation, useParams } from 'react-router-dom';
|
||||
import { AppPath, SettingsPath } from 'twenty-shared/types';
|
||||
@@ -23,7 +23,7 @@ export const usePageChangeEffectNavigateLocation = () => {
|
||||
);
|
||||
const { defaultHomePagePath } = useDefaultHomePagePath();
|
||||
const location = useLocation();
|
||||
const calendarBookingPageId = useRecoilValueV2(calendarBookingPageIdState);
|
||||
const calendarBookingPageId = useAtomStateValue(calendarBookingPageIdState);
|
||||
|
||||
const someMatchingLocationOf = (appPaths: AppPath[]): boolean =>
|
||||
appPaths.some((appPath) => isMatchingLocation(location, appPath));
|
||||
@@ -45,11 +45,11 @@ export const usePageChangeEffectNavigateLocation = () => {
|
||||
];
|
||||
|
||||
const objectNamePlural = useParams().objectNamePlural ?? '';
|
||||
const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState);
|
||||
const objectMetadataItems = useAtomStateValue(objectMetadataItemsState);
|
||||
const objectMetadataItem = objectMetadataItems?.find(
|
||||
(objectMetadataItem) => objectMetadataItem.namePlural === objectNamePlural,
|
||||
);
|
||||
const verifyEmailRedirectPath = useRecoilValueV2(
|
||||
const verifyEmailRedirectPath = useAtomStateValue(
|
||||
verifyEmailRedirectPathState,
|
||||
);
|
||||
|
||||
|
||||
@@ -2,14 +2,14 @@ import { type Locale } from 'date-fns';
|
||||
import { enUS } from 'date-fns/locale';
|
||||
import { type APP_LOCALES } from 'twenty-shared/translations';
|
||||
|
||||
import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2';
|
||||
import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState';
|
||||
|
||||
type DateLocaleState = {
|
||||
locale?: keyof typeof APP_LOCALES;
|
||||
localeCatalog: Locale;
|
||||
};
|
||||
|
||||
export const dateLocaleState = createStateV2<DateLocaleState>({
|
||||
export const dateLocaleState = createAtomState<DateLocaleState>({
|
||||
key: 'dateLocaleState',
|
||||
defaultValue: {
|
||||
locale: undefined,
|
||||
|
||||
@@ -8,7 +8,7 @@ import { useCloseActionMenu } from '@/action-menu/hooks/useCloseActionMenu';
|
||||
import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';
|
||||
import { useModal } from '@/ui/layout/modal/hooks/useModal';
|
||||
import { isModalOpenedComponentState } from '@/ui/layout/modal/states/isModalOpenedComponentState';
|
||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2';
|
||||
import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';
|
||||
import { type ButtonAccent } from 'twenty-ui/input';
|
||||
|
||||
export type ActionModalProps = {
|
||||
@@ -49,7 +49,7 @@ export const ActionModal = ({
|
||||
|
||||
const modalId = `${actionConfig?.key}-action-modal-${actionMenuType}`;
|
||||
|
||||
const isModalOpened = useRecoilComponentValueV2(
|
||||
const isModalOpened = useAtomComponentStateValue(
|
||||
isModalOpenedComponentState,
|
||||
modalId,
|
||||
);
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@ import { ActionDisplay } from '@/action-menu/actions/display/components/ActionDi
|
||||
import { ActionConfigContext } from '@/action-menu/contexts/ActionConfigContext';
|
||||
import { useNavigateCommandMenu } from '@/command-menu/hooks/useNavigateCommandMenu';
|
||||
import { commandMenuSearchState } from '@/command-menu/states/commandMenuSearchState';
|
||||
import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2';
|
||||
import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';
|
||||
import { type MessageDescriptor } from '@lingui/core';
|
||||
import { t } from '@lingui/core/macro';
|
||||
import { useContext } from 'react';
|
||||
@@ -26,7 +26,7 @@ export const ActionOpenSidePanelPage = ({
|
||||
|
||||
const { navigateCommandMenu } = useNavigateCommandMenu();
|
||||
|
||||
const setCommandMenuSearchState = useSetRecoilStateV2(commandMenuSearchState);
|
||||
const setCommandMenuSearchState = useSetAtomState(commandMenuSearchState);
|
||||
|
||||
if (!actionConfig) {
|
||||
return null;
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@ import { SelectableListItem } from '@/ui/layout/selectable-list/components/Selec
|
||||
import { SelectableListComponentInstanceContext } from '@/ui/layout/selectable-list/states/contexts/SelectableListComponentInstanceContext';
|
||||
import { isSelectedItemIdComponentFamilyState } from '@/ui/layout/selectable-list/states/isSelectedItemIdComponentFamilyState';
|
||||
import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow';
|
||||
import { useRecoilComponentFamilyValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyValueV2';
|
||||
import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { MenuItem } from 'twenty-ui/navigation';
|
||||
@@ -31,7 +31,7 @@ export const ActionDropdownItem = ({
|
||||
SelectableListComponentInstanceContext,
|
||||
);
|
||||
|
||||
const isSelected = useRecoilComponentFamilyValueV2(
|
||||
const isSelected = useAtomComponentFamilyStateValue(
|
||||
isSelectedItemIdComponentFamilyState,
|
||||
action.key,
|
||||
selectableListInstanceId,
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
import { ActionConfigContext } from '@/action-menu/contexts/ActionConfigContext';
|
||||
import { useCloseActionMenu } from '@/action-menu/hooks/useCloseActionMenu';
|
||||
import { isHeadlessFrontComponentMountedFamilySelector } from '@/front-components/selectors/isHeadlessFrontComponentMountedFamilySelector';
|
||||
import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2';
|
||||
import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue';
|
||||
import { useContext } from 'react';
|
||||
|
||||
import { ActionDisplay } from './ActionDisplay';
|
||||
@@ -20,7 +20,7 @@ export const HeadlessFrontComponentAction = ({
|
||||
closeSidePanelOnCommandMenuListActionExecution: false,
|
||||
});
|
||||
|
||||
const isMounted = useFamilySelectorValueV2(
|
||||
const isMounted = useAtomFamilySelectorValue(
|
||||
isHeadlessFrontComponentMountedFamilySelector,
|
||||
frontComponentId,
|
||||
);
|
||||
|
||||
+6
-6
@@ -14,7 +14,7 @@ import { useRemoveSelectedRecordsFromRecordBoard } from '@/object-record/record-
|
||||
import { useFilterValueDependencies } from '@/object-record/record-filter/hooks/useFilterValueDependencies';
|
||||
import { useRecordIndexIdFromCurrentContextStore } from '@/object-record/record-index/hooks/useRecordIndexIdFromCurrentContextStore';
|
||||
import { useResetTableRowSelection } from '@/object-record/record-table/hooks/internal/useResetTableRowSelection';
|
||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2';
|
||||
import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';
|
||||
import { useContext } from 'react';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
@@ -22,7 +22,7 @@ export const DeleteMultipleRecordsAction = () => {
|
||||
const { recordIndexId, objectMetadataItem } =
|
||||
useRecordIndexIdFromCurrentContextStore();
|
||||
|
||||
const contextStoreCurrentViewId = useRecoilComponentValueV2(
|
||||
const contextStoreCurrentViewId = useAtomComponentStateValue(
|
||||
contextStoreCurrentViewIdComponentState,
|
||||
recordIndexId,
|
||||
);
|
||||
@@ -33,22 +33,22 @@ export const DeleteMultipleRecordsAction = () => {
|
||||
|
||||
const { resetTableRowSelection } = useResetTableRowSelection(recordIndexId);
|
||||
|
||||
const contextStoreTargetedRecordsRule = useRecoilComponentValueV2(
|
||||
const contextStoreTargetedRecordsRule = useAtomComponentStateValue(
|
||||
contextStoreTargetedRecordsRuleComponentState,
|
||||
recordIndexId,
|
||||
);
|
||||
|
||||
const contextStoreFilters = useRecoilComponentValueV2(
|
||||
const contextStoreFilters = useAtomComponentStateValue(
|
||||
contextStoreFiltersComponentState,
|
||||
recordIndexId,
|
||||
);
|
||||
|
||||
const contextStoreFilterGroups = useRecoilComponentValueV2(
|
||||
const contextStoreFilterGroups = useAtomComponentStateValue(
|
||||
contextStoreFilterGroupsComponentState,
|
||||
recordIndexId,
|
||||
);
|
||||
|
||||
const contextStoreAnyFieldFilterValue = useRecoilComponentValueV2(
|
||||
const contextStoreAnyFieldFilterValue = useAtomComponentStateValue(
|
||||
contextStoreAnyFieldFilterValueComponentState,
|
||||
recordIndexId,
|
||||
);
|
||||
|
||||
+6
-6
@@ -14,7 +14,7 @@ import { useRemoveSelectedRecordsFromRecordBoard } from '@/object-record/record-
|
||||
import { useFilterValueDependencies } from '@/object-record/record-filter/hooks/useFilterValueDependencies';
|
||||
import { useRecordIndexIdFromCurrentContextStore } from '@/object-record/record-index/hooks/useRecordIndexIdFromCurrentContextStore';
|
||||
import { useResetTableRowSelection } from '@/object-record/record-table/hooks/internal/useResetTableRowSelection';
|
||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2';
|
||||
import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';
|
||||
import { t } from '@lingui/core/macro';
|
||||
import { useContext } from 'react';
|
||||
import { type RecordGqlOperationFilter } from 'twenty-shared/types';
|
||||
@@ -24,7 +24,7 @@ export const DestroyMultipleRecordsAction = () => {
|
||||
const { recordIndexId, objectMetadataItem } =
|
||||
useRecordIndexIdFromCurrentContextStore();
|
||||
|
||||
const contextStoreCurrentViewId = useRecoilComponentValueV2(
|
||||
const contextStoreCurrentViewId = useAtomComponentStateValue(
|
||||
contextStoreCurrentViewIdComponentState,
|
||||
recordIndexId,
|
||||
);
|
||||
@@ -37,22 +37,22 @@ export const DestroyMultipleRecordsAction = () => {
|
||||
const { removeSelectedRecordsFromRecordBoard } =
|
||||
useRemoveSelectedRecordsFromRecordBoard(recordIndexId);
|
||||
|
||||
const contextStoreTargetedRecordsRule = useRecoilComponentValueV2(
|
||||
const contextStoreTargetedRecordsRule = useAtomComponentStateValue(
|
||||
contextStoreTargetedRecordsRuleComponentState,
|
||||
recordIndexId,
|
||||
);
|
||||
|
||||
const contextStoreFilters = useRecoilComponentValueV2(
|
||||
const contextStoreFilters = useAtomComponentStateValue(
|
||||
contextStoreFiltersComponentState,
|
||||
recordIndexId,
|
||||
);
|
||||
|
||||
const contextStoreFilterGroups = useRecoilComponentValueV2(
|
||||
const contextStoreFilterGroups = useAtomComponentStateValue(
|
||||
contextStoreFilterGroupsComponentState,
|
||||
recordIndexId,
|
||||
);
|
||||
|
||||
const contextStoreAnyFieldFilterValue = useRecoilComponentValueV2(
|
||||
const contextStoreAnyFieldFilterValue = useAtomComponentStateValue(
|
||||
contextStoreAnyFieldFilterValueComponentState,
|
||||
recordIndexId,
|
||||
);
|
||||
|
||||
+2
-2
@@ -7,14 +7,14 @@ import { useContextStoreObjectMetadataItemOrThrow } from '@/context-store/hooks/
|
||||
import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/contextStoreCurrentViewIdComponentState';
|
||||
import { useRecordIndexExportRecords } from '@/object-record/record-index/export/hooks/useRecordIndexExportRecords';
|
||||
import { getRecordIndexIdFromObjectNamePluralAndViewId } from '@/object-record/utils/getRecordIndexIdFromObjectNamePluralAndViewId';
|
||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2';
|
||||
import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';
|
||||
import { useContext } from 'react';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
export const ExportMultipleRecordsAction = () => {
|
||||
const { objectMetadataItem } = useContextStoreObjectMetadataItemOrThrow();
|
||||
|
||||
const contextStoreCurrentViewId = useRecoilComponentValueV2(
|
||||
const contextStoreCurrentViewId = useAtomComponentStateValue(
|
||||
contextStoreCurrentViewIdComponentState,
|
||||
);
|
||||
|
||||
|
||||
+2
-2
@@ -3,12 +3,12 @@ import { useSelectedRecordIds } from '@/action-menu/actions/record-actions/singl
|
||||
import { useOpenMergeRecordsPageInCommandMenu } from '@/command-menu/hooks/useOpenMergeRecordsPageInCommandMenu';
|
||||
import { useContextStoreObjectMetadataItemOrThrow } from '@/context-store/hooks/useContextStoreObjectMetadataItemOrThrow';
|
||||
import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/contextStoreCurrentViewIdComponentState';
|
||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2';
|
||||
import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';
|
||||
|
||||
export const MergeMultipleRecordsAction = () => {
|
||||
const { objectMetadataItem } = useContextStoreObjectMetadataItemOrThrow();
|
||||
|
||||
const contextStoreCurrentViewId = useRecoilComponentValueV2(
|
||||
const contextStoreCurrentViewId = useAtomComponentStateValue(
|
||||
contextStoreCurrentViewIdComponentState,
|
||||
);
|
||||
|
||||
|
||||
+6
-6
@@ -12,7 +12,7 @@ import { useRemoveSelectedRecordsFromRecordBoard } from '@/object-record/record-
|
||||
import { useFilterValueDependencies } from '@/object-record/record-filter/hooks/useFilterValueDependencies';
|
||||
import { useRecordIndexIdFromCurrentContextStore } from '@/object-record/record-index/hooks/useRecordIndexIdFromCurrentContextStore';
|
||||
import { useResetTableRowSelection } from '@/object-record/record-table/hooks/internal/useResetTableRowSelection';
|
||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2';
|
||||
import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';
|
||||
import { t } from '@lingui/core/macro';
|
||||
import { type RecordGqlOperationFilter } from 'twenty-shared/types';
|
||||
|
||||
@@ -20,7 +20,7 @@ export const RestoreMultipleRecordsAction = () => {
|
||||
const { recordIndexId, objectMetadataItem } =
|
||||
useRecordIndexIdFromCurrentContextStore();
|
||||
|
||||
const contextStoreCurrentViewId = useRecoilComponentValueV2(
|
||||
const contextStoreCurrentViewId = useAtomComponentStateValue(
|
||||
contextStoreCurrentViewIdComponentState,
|
||||
recordIndexId,
|
||||
);
|
||||
@@ -37,22 +37,22 @@ export const RestoreMultipleRecordsAction = () => {
|
||||
objectNameSingular: objectMetadataItem.nameSingular,
|
||||
});
|
||||
|
||||
const contextStoreTargetedRecordsRule = useRecoilComponentValueV2(
|
||||
const contextStoreTargetedRecordsRule = useAtomComponentStateValue(
|
||||
contextStoreTargetedRecordsRuleComponentState,
|
||||
recordIndexId,
|
||||
);
|
||||
|
||||
const contextStoreFilters = useRecoilComponentValueV2(
|
||||
const contextStoreFilters = useAtomComponentStateValue(
|
||||
contextStoreFiltersComponentState,
|
||||
recordIndexId,
|
||||
);
|
||||
|
||||
const contextStoreFilterGroups = useRecoilComponentValueV2(
|
||||
const contextStoreFilterGroups = useAtomComponentStateValue(
|
||||
contextStoreFilterGroupsComponentState,
|
||||
recordIndexId,
|
||||
);
|
||||
|
||||
const contextStoreAnyFieldFilterValue = useRecoilComponentValueV2(
|
||||
const contextStoreAnyFieldFilterValue = useAtomComponentStateValue(
|
||||
contextStoreAnyFieldFilterValueComponentState,
|
||||
recordIndexId,
|
||||
);
|
||||
|
||||
+4
-4
@@ -3,8 +3,8 @@ import { useContextStoreObjectMetadataItemOrThrow } from '@/context-store/hooks/
|
||||
import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/contextStoreCurrentViewIdComponentState';
|
||||
import { getRecordIndexIdFromObjectNamePluralAndViewId } from '@/object-record/utils/getRecordIndexIdFromObjectNamePluralAndViewId';
|
||||
import { useOpenDropdown } from '@/ui/layout/dropdown/hooks/useOpenDropdown';
|
||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2';
|
||||
import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2';
|
||||
import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';
|
||||
import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState';
|
||||
import { VIEW_PICKER_DROPDOWN_ID } from '@/views/view-picker/constants/ViewPickerDropdownId';
|
||||
import { useViewPickerMode } from '@/views/view-picker/hooks/useViewPickerMode';
|
||||
import { viewPickerReferenceViewIdComponentState } from '@/views/view-picker/states/viewPickerReferenceViewIdComponentState';
|
||||
@@ -13,7 +13,7 @@ export const CreateNewViewNoSelectionRecord = () => {
|
||||
const { objectMetadataItem } = useContextStoreObjectMetadataItemOrThrow();
|
||||
const { openDropdown } = useOpenDropdown();
|
||||
|
||||
const currentViewId = useRecoilComponentValueV2(
|
||||
const currentViewId = useAtomComponentStateValue(
|
||||
contextStoreCurrentViewIdComponentState,
|
||||
);
|
||||
|
||||
@@ -26,7 +26,7 @@ export const CreateNewViewNoSelectionRecord = () => {
|
||||
currentViewId,
|
||||
);
|
||||
|
||||
const setViewPickerReferenceViewId = useSetRecoilComponentStateV2(
|
||||
const setViewPickerReferenceViewId = useSetAtomComponentState(
|
||||
viewPickerReferenceViewIdComponentState,
|
||||
recordIndexId,
|
||||
);
|
||||
|
||||
+3
-3
@@ -6,13 +6,13 @@ import { useRemoveRecordFilter } from '@/object-record/record-filter/hooks/useRe
|
||||
import { currentRecordFiltersComponentState } from '@/object-record/record-filter/states/currentRecordFiltersComponentState';
|
||||
import { useHandleToggleTrashColumnFilter } from '@/object-record/record-index/hooks/useHandleToggleTrashColumnFilter';
|
||||
import { getRecordIndexIdFromObjectNamePluralAndViewId } from '@/object-record/utils/getRecordIndexIdFromObjectNamePluralAndViewId';
|
||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2';
|
||||
import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
export const HideDeletedRecordsNoSelectionRecordAction = () => {
|
||||
const { objectMetadataItem } = useContextStoreObjectMetadataItemOrThrow();
|
||||
|
||||
const currentViewId = useRecoilComponentValueV2(
|
||||
const currentViewId = useAtomComponentStateValue(
|
||||
contextStoreCurrentViewIdComponentState,
|
||||
);
|
||||
|
||||
@@ -32,7 +32,7 @@ export const HideDeletedRecordsNoSelectionRecordAction = () => {
|
||||
|
||||
const { isRecordFilterAboutSoftDelete } = useCheckIsSoftDeleteFilter();
|
||||
|
||||
const currentRecordFilters = useRecoilComponentValueV2(
|
||||
const currentRecordFilters = useAtomComponentStateValue(
|
||||
currentRecordFiltersComponentState,
|
||||
recordIndexId,
|
||||
);
|
||||
|
||||
+2
-2
@@ -3,12 +3,12 @@ import { useContextStoreObjectMetadataItemOrThrow } from '@/context-store/hooks/
|
||||
import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/contextStoreCurrentViewIdComponentState';
|
||||
import { useHandleToggleTrashColumnFilter } from '@/object-record/record-index/hooks/useHandleToggleTrashColumnFilter';
|
||||
import { getRecordIndexIdFromObjectNamePluralAndViewId } from '@/object-record/utils/getRecordIndexIdFromObjectNamePluralAndViewId';
|
||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2';
|
||||
import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';
|
||||
|
||||
export const SeeDeletedRecordsNoSelectionRecordAction = () => {
|
||||
const { objectMetadataItem } = useContextStoreObjectMetadataItemOrThrow();
|
||||
|
||||
const currentViewId = useRecoilComponentValueV2(
|
||||
const currentViewId = useAtomComponentStateValue(
|
||||
contextStoreCurrentViewIdComponentState,
|
||||
);
|
||||
|
||||
|
||||
+3
-3
@@ -8,7 +8,7 @@ import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataI
|
||||
import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState';
|
||||
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
|
||||
import { useRecordIndexIdFromCurrentContextStore } from '@/object-record/record-index/hooks/useRecordIndexIdFromCurrentContextStore';
|
||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2';
|
||||
import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';
|
||||
import { useActiveWorkflowVersionsWithManualTrigger } from '@/workflow/hooks/useActiveWorkflowVersionsWithManualTrigger';
|
||||
import { useRunWorkflowVersion } from '@/workflow/hooks/useRunWorkflowVersion';
|
||||
|
||||
@@ -33,12 +33,12 @@ export const useRunWorkflowRecordActions = ({
|
||||
const { enqueueWarningSnackBar } = useSnackBar();
|
||||
const { recordIndexId } = useRecordIndexIdFromCurrentContextStore();
|
||||
|
||||
const contextStoreTargetedRecordsRule = useRecoilComponentValueV2(
|
||||
const contextStoreTargetedRecordsRule = useAtomComponentStateValue(
|
||||
contextStoreTargetedRecordsRuleComponentState,
|
||||
recordIndexId,
|
||||
);
|
||||
|
||||
const isPageInEditMode = useRecoilComponentValueV2(
|
||||
const isPageInEditMode = useAtomComponentStateValue(
|
||||
contextStoreIsPageInEditModeComponentState,
|
||||
recordIndexId,
|
||||
);
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ import { useSelectedRecordIdOrThrow } from '@/action-menu/actions/record-actions
|
||||
import { useContextStoreObjectMetadataItemOrThrow } from '@/context-store/hooks/useContextStoreObjectMetadataItemOrThrow';
|
||||
import { useCreateFavorite } from '@/favorites/hooks/useCreateFavorite';
|
||||
import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState';
|
||||
import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2';
|
||||
import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
export const AddToFavoritesSingleRecordAction = () => {
|
||||
@@ -13,7 +13,7 @@ export const AddToFavoritesSingleRecordAction = () => {
|
||||
|
||||
const { createFavorite } = useCreateFavorite();
|
||||
|
||||
const selectedRecord = useFamilyRecoilValueV2(
|
||||
const selectedRecord = useAtomFamilyStateValue(
|
||||
recordStoreFamilyState,
|
||||
recordId,
|
||||
);
|
||||
|
||||
+2
-2
@@ -1,13 +1,13 @@
|
||||
import { Action } from '@/action-menu/actions/components/Action';
|
||||
import { useSelectedRecordIdOrThrow } from '@/action-menu/actions/record-actions/single-record/hooks/useSelectedRecordIdOrThrow';
|
||||
import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState';
|
||||
import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2';
|
||||
import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
export const ExportNoteActionSingleRecordAction = () => {
|
||||
const recordId = useSelectedRecordIdOrThrow();
|
||||
|
||||
const selectedRecord = useFamilyRecoilValueV2(
|
||||
const selectedRecord = useAtomFamilyStateValue(
|
||||
recordStoreFamilyState,
|
||||
recordId,
|
||||
);
|
||||
|
||||
+2
-2
@@ -2,14 +2,14 @@ import { useSelectedRecordIdOrThrow } from '@/action-menu/actions/record-actions
|
||||
import { useContextStoreObjectMetadataItemOrThrow } from '@/context-store/hooks/useContextStoreObjectMetadataItemOrThrow';
|
||||
import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/contextStoreCurrentViewIdComponentState';
|
||||
import { useExportSingleRecord } from '@/object-record/record-show/hooks/useExportSingleRecord';
|
||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2';
|
||||
import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';
|
||||
|
||||
import { Action } from '@/action-menu/actions/components/Action';
|
||||
|
||||
export const ExportSingleRecordAction = () => {
|
||||
const { objectMetadataItem } = useContextStoreObjectMetadataItemOrThrow();
|
||||
|
||||
const contextStoreCurrentViewId = useRecoilComponentValueV2(
|
||||
const contextStoreCurrentViewId = useAtomComponentStateValue(
|
||||
contextStoreCurrentViewIdComponentState,
|
||||
);
|
||||
|
||||
|
||||
+2
-2
@@ -4,12 +4,12 @@ import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu';
|
||||
import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState';
|
||||
import { useResetDraftPageLayoutToPersistedPageLayout } from '@/page-layout/hooks/useResetDraftPageLayoutToPersistedPageLayout';
|
||||
import { useSetIsPageLayoutInEditMode } from '@/page-layout/hooks/useSetIsPageLayoutInEditMode';
|
||||
import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2';
|
||||
import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue';
|
||||
|
||||
export const CancelDashboardSingleRecordAction = () => {
|
||||
const recordId = useSelectedRecordIdOrThrow();
|
||||
|
||||
const selectedRecord = useFamilyRecoilValueV2(
|
||||
const selectedRecord = useAtomFamilyStateValue(
|
||||
recordStoreFamilyState,
|
||||
recordId,
|
||||
);
|
||||
|
||||
+2
-2
@@ -2,13 +2,13 @@ import { Action } from '@/action-menu/actions/components/Action';
|
||||
import { useSelectedRecordIdOrThrow } from '@/action-menu/actions/record-actions/single-record/hooks/useSelectedRecordIdOrThrow';
|
||||
import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState';
|
||||
import { useSetIsPageLayoutInEditMode } from '@/page-layout/hooks/useSetIsPageLayoutInEditMode';
|
||||
import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2';
|
||||
import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue';
|
||||
import { useResetLocationHash } from 'twenty-ui/utilities';
|
||||
|
||||
export const EditDashboardSingleRecordAction = () => {
|
||||
const recordId = useSelectedRecordIdOrThrow();
|
||||
|
||||
const selectedRecord = useFamilyRecoilValueV2(
|
||||
const selectedRecord = useAtomFamilyStateValue(
|
||||
recordStoreFamilyState,
|
||||
recordId,
|
||||
);
|
||||
|
||||
+2
-2
@@ -4,12 +4,12 @@ import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu';
|
||||
import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState';
|
||||
import { useSavePageLayout } from '@/page-layout/hooks/useSavePageLayout';
|
||||
import { useSetIsPageLayoutInEditMode } from '@/page-layout/hooks/useSetIsPageLayoutInEditMode';
|
||||
import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2';
|
||||
import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue';
|
||||
|
||||
export const SaveDashboardSingleRecordAction = () => {
|
||||
const recordId = useSelectedRecordIdOrThrow();
|
||||
|
||||
const selectedRecord = useFamilyRecoilValueV2(
|
||||
const selectedRecord = useAtomFamilyStateValue(
|
||||
recordStoreFamilyState,
|
||||
recordId,
|
||||
);
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
import { contextStoreTargetedRecordsRuleComponentState } from '@/context-store/states/contextStoreTargetedRecordsRuleComponentState';
|
||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2';
|
||||
import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';
|
||||
|
||||
export const useSelectedRecordIdOrThrow = () => {
|
||||
const contextStoreTargetedRecordsRule = useRecoilComponentValueV2(
|
||||
const contextStoreTargetedRecordsRule = useAtomComponentStateValue(
|
||||
contextStoreTargetedRecordsRuleComponentState,
|
||||
);
|
||||
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
import { contextStoreTargetedRecordsRuleComponentState } from '@/context-store/states/contextStoreTargetedRecordsRuleComponentState';
|
||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2';
|
||||
import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';
|
||||
|
||||
export const useSelectedRecordIds = () => {
|
||||
const contextStoreTargetedRecordsRule = useRecoilComponentValueV2(
|
||||
const contextStoreTargetedRecordsRule = useAtomComponentStateValue(
|
||||
contextStoreTargetedRecordsRuleComponentState,
|
||||
);
|
||||
|
||||
|
||||
+2
-2
@@ -2,13 +2,13 @@ import { ActionLink } from '@/action-menu/actions/components/ActionLink';
|
||||
import { useSelectedRecordIdOrThrow } from '@/action-menu/actions/record-actions/single-record/hooks/useSelectedRecordIdOrThrow';
|
||||
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||
import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState';
|
||||
import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2';
|
||||
import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue';
|
||||
import { AppPath } from 'twenty-shared/types';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
export const SeeVersionWorkflowRunSingleRecordAction = () => {
|
||||
const recordId = useSelectedRecordIdOrThrow();
|
||||
const workflowRun = useFamilyRecoilValueV2(recordStoreFamilyState, recordId);
|
||||
const workflowRun = useAtomFamilyStateValue(recordStoreFamilyState, recordId);
|
||||
|
||||
if (!isDefined(workflowRun) || !isDefined(workflowRun?.workflowVersion?.id)) {
|
||||
return null;
|
||||
|
||||
+2
-2
@@ -2,13 +2,13 @@ import { ActionLink } from '@/action-menu/actions/components/ActionLink';
|
||||
import { useSelectedRecordIdOrThrow } from '@/action-menu/actions/record-actions/single-record/hooks/useSelectedRecordIdOrThrow';
|
||||
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||
import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState';
|
||||
import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2';
|
||||
import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue';
|
||||
import { AppPath } from 'twenty-shared/types';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
export const SeeWorkflowWorkflowRunSingleRecordAction = () => {
|
||||
const recordId = useSelectedRecordIdOrThrow();
|
||||
const workflowRun = useFamilyRecoilValueV2(recordStoreFamilyState, recordId);
|
||||
const workflowRun = useAtomFamilyStateValue(recordStoreFamilyState, recordId);
|
||||
|
||||
if (!isDefined(workflowRun) || !isDefined(workflowRun?.workflow?.id)) {
|
||||
return null;
|
||||
|
||||
+5
-5
@@ -9,29 +9,29 @@ import { DEFAULT_QUERY_PAGE_SIZE } from '@/object-record/constants/DefaultQueryP
|
||||
import { useLazyFetchAllRecords } from '@/object-record/hooks/useLazyFetchAllRecords';
|
||||
import { useFilterValueDependencies } from '@/object-record/record-filter/hooks/useFilterValueDependencies';
|
||||
import { useRecordIndexIdFromCurrentContextStore } from '@/object-record/record-index/hooks/useRecordIndexIdFromCurrentContextStore';
|
||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2';
|
||||
import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';
|
||||
import { useStopWorkflowRun } from '@/workflow/hooks/useStopWorkflowRun';
|
||||
|
||||
export const StopWorkflowRunSingleRecordAction = () => {
|
||||
const { objectMetadataItem, recordIndexId } =
|
||||
useRecordIndexIdFromCurrentContextStore();
|
||||
|
||||
const contextStoreTargetedRecordsRule = useRecoilComponentValueV2(
|
||||
const contextStoreTargetedRecordsRule = useAtomComponentStateValue(
|
||||
contextStoreTargetedRecordsRuleComponentState,
|
||||
recordIndexId,
|
||||
);
|
||||
|
||||
const contextStoreFilters = useRecoilComponentValueV2(
|
||||
const contextStoreFilters = useAtomComponentStateValue(
|
||||
contextStoreFiltersComponentState,
|
||||
recordIndexId,
|
||||
);
|
||||
|
||||
const contextStoreFilterGroups = useRecoilComponentValueV2(
|
||||
const contextStoreFilterGroups = useAtomComponentStateValue(
|
||||
contextStoreFilterGroupsComponentState,
|
||||
recordIndexId,
|
||||
);
|
||||
|
||||
const contextStoreAnyFieldFilterValue = useRecoilComponentValueV2(
|
||||
const contextStoreAnyFieldFilterValue = useAtomComponentStateValue(
|
||||
contextStoreAnyFieldFilterValueComponentState,
|
||||
recordIndexId,
|
||||
);
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@ import { ActionLink } from '@/action-menu/actions/components/ActionLink';
|
||||
import { useSelectedRecordIdOrThrow } from '@/action-menu/actions/record-actions/single-record/hooks/useSelectedRecordIdOrThrow';
|
||||
import { CoreObjectNamePlural } from '@/object-metadata/types/CoreObjectNamePlural';
|
||||
import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState';
|
||||
import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2';
|
||||
import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue';
|
||||
import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion';
|
||||
import { AppPath, ViewFilterOperand } from 'twenty-shared/types';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
@@ -40,7 +40,7 @@ const SeeRunsWorkflowVersionSingleRecordActionContent = ({
|
||||
|
||||
export const SeeRunsWorkflowVersionSingleRecordAction = () => {
|
||||
const recordId = useSelectedRecordIdOrThrow();
|
||||
const workflowVersion = useFamilyRecoilValueV2(
|
||||
const workflowVersion = useAtomFamilyStateValue(
|
||||
recordStoreFamilyState,
|
||||
recordId,
|
||||
);
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ import { useSelectedRecordIdOrThrow } from '@/action-menu/actions/record-actions
|
||||
import { CoreObjectNamePlural } from '@/object-metadata/types/CoreObjectNamePlural';
|
||||
import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState';
|
||||
import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion';
|
||||
import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2';
|
||||
import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue';
|
||||
import { AppPath, ViewFilterOperand } from 'twenty-shared/types';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
@@ -33,7 +33,7 @@ const SeeVersionsWorkflowVersionSingleRecordActionContent = ({
|
||||
|
||||
export const SeeVersionsWorkflowVersionSingleRecordAction = () => {
|
||||
const recordId = useSelectedRecordIdOrThrow();
|
||||
const workflowVersion = useFamilyRecoilValueV2(
|
||||
const workflowVersion = useAtomFamilyStateValue(
|
||||
recordStoreFamilyState,
|
||||
recordId,
|
||||
);
|
||||
|
||||
+2
-2
@@ -2,12 +2,12 @@ import { ActionLink } from '@/action-menu/actions/components/ActionLink';
|
||||
import { useSelectedRecordIdOrThrow } from '@/action-menu/actions/record-actions/single-record/hooks/useSelectedRecordIdOrThrow';
|
||||
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||
import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState';
|
||||
import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2';
|
||||
import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue';
|
||||
import { AppPath } from 'twenty-shared/types';
|
||||
|
||||
export const SeeWorkflowWorkflowVersionSingleRecordAction = () => {
|
||||
const recordId = useSelectedRecordIdOrThrow();
|
||||
const workflowVersion = useFamilyRecoilValueV2(
|
||||
const workflowVersion = useAtomFamilyStateValue(
|
||||
recordStoreFamilyState,
|
||||
recordId,
|
||||
);
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@ import { ActionType } from '@/action-menu/actions/types/ActionType';
|
||||
import { ActionMenuContext } from '@/action-menu/contexts/ActionMenuContext';
|
||||
import { MAIN_CONTEXT_STORE_INSTANCE_ID } from '@/context-store/constants/MainContextStoreInstanceId';
|
||||
import { contextStoreIsPageInEditModeComponentState } from '@/context-store/states/contextStoreIsPageInEditModeComponentState';
|
||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2';
|
||||
import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';
|
||||
import { useActiveWorkflowVersionsWithManualTrigger } from '@/workflow/hooks/useActiveWorkflowVersionsWithManualTrigger';
|
||||
import { useRunWorkflowVersion } from '@/workflow/hooks/useRunWorkflowVersion';
|
||||
import { COMMAND_MENU_DEFAULT_ICON } from '@/workflow/workflow-trigger/constants/CommandMenuDefaultIcon';
|
||||
@@ -15,7 +15,7 @@ import { useIcons } from 'twenty-ui/display';
|
||||
export const useRunWorkflowRecordAgnosticActions = () => {
|
||||
const { getIcon } = useIcons();
|
||||
|
||||
const isPageInEditMode = useRecoilComponentValueV2(
|
||||
const isPageInEditMode = useAtomComponentStateValue(
|
||||
contextStoreIsPageInEditModeComponentState,
|
||||
MAIN_CONTEXT_STORE_INSTANCE_ID,
|
||||
);
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2';
|
||||
import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState';
|
||||
|
||||
export const forceRegisteredActionsByKeyState = createStateV2<
|
||||
export const forceRegisteredActionsByKeyState = createAtomState<
|
||||
Record<string, boolean | undefined>
|
||||
>({
|
||||
key: 'forceRegisteredActionsByKeyComponentState',
|
||||
|
||||
@@ -3,11 +3,11 @@ import { RecordIndexActionMenuDropdown } from '@/action-menu/components/RecordIn
|
||||
import { ActionMenuContextProvider } from '@/action-menu/contexts/ActionMenuContextProvider';
|
||||
import { MAIN_CONTEXT_STORE_INSTANCE_ID } from '@/context-store/constants/MainContextStoreInstanceId';
|
||||
import { contextStoreCurrentObjectMetadataItemIdComponentState } from '@/context-store/states/contextStoreCurrentObjectMetadataItemIdComponentState';
|
||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2';
|
||||
import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';
|
||||
import { useIsMobile } from 'twenty-ui/utilities';
|
||||
|
||||
export const RecordIndexActionMenu = () => {
|
||||
const contextStoreCurrentObjectMetadataItemId = useRecoilComponentValueV2(
|
||||
const contextStoreCurrentObjectMetadataItemId = useAtomComponentStateValue(
|
||||
contextStoreCurrentObjectMetadataItemIdComponentState,
|
||||
MAIN_CONTEXT_STORE_INSTANCE_ID,
|
||||
);
|
||||
|
||||
+3
-3
@@ -15,7 +15,7 @@ import { SelectableList } from '@/ui/layout/selectable-list/components/Selectabl
|
||||
import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem';
|
||||
import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState';
|
||||
import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow';
|
||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2';
|
||||
import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';
|
||||
import styled from '@emotion/styled';
|
||||
import { useLingui } from '@lingui/react/macro';
|
||||
import { useContext } from 'react';
|
||||
@@ -49,7 +49,7 @@ export const RecordIndexActionMenuDropdown = () => {
|
||||
const dropdownId = getActionMenuDropdownIdFromActionMenuId(actionMenuId);
|
||||
const { closeDropdown } = useCloseDropdown();
|
||||
|
||||
const actionMenuDropdownPosition = useRecoilComponentValueV2(
|
||||
const actionMenuDropdownPosition = useAtomComponentStateValue(
|
||||
recordIndexActionMenuDropdownPositionComponentState,
|
||||
dropdownId,
|
||||
);
|
||||
@@ -61,7 +61,7 @@ export const RecordIndexActionMenuDropdown = () => {
|
||||
'more-actions',
|
||||
];
|
||||
|
||||
const selectedItemId = useRecoilComponentValueV2(
|
||||
const selectedItemId = useAtomComponentStateValue(
|
||||
selectedItemIdComponentState,
|
||||
dropdownId,
|
||||
);
|
||||
|
||||
@@ -3,16 +3,16 @@ import { ActionMenuContextProvider } from '@/action-menu/contexts/ActionMenuCont
|
||||
import { MAIN_CONTEXT_STORE_INSTANCE_ID } from '@/context-store/constants/MainContextStoreInstanceId';
|
||||
import { contextStoreCurrentObjectMetadataItemIdComponentState } from '@/context-store/states/contextStoreCurrentObjectMetadataItemIdComponentState';
|
||||
import { contextStoreTargetedRecordsRuleComponentState } from '@/context-store/states/contextStoreTargetedRecordsRuleComponentState';
|
||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2';
|
||||
import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';
|
||||
import { useIsMobile } from 'twenty-ui/utilities';
|
||||
|
||||
export const RecordShowActionMenu = () => {
|
||||
const contextStoreCurrentObjectMetadataItemId = useRecoilComponentValueV2(
|
||||
const contextStoreCurrentObjectMetadataItemId = useAtomComponentStateValue(
|
||||
contextStoreCurrentObjectMetadataItemIdComponentState,
|
||||
MAIN_CONTEXT_STORE_INSTANCE_ID,
|
||||
);
|
||||
|
||||
const contextStoreTargetedRecordsRule = useRecoilComponentValueV2(
|
||||
const contextStoreTargetedRecordsRule = useAtomComponentStateValue(
|
||||
contextStoreTargetedRecordsRuleComponentState,
|
||||
MAIN_CONTEXT_STORE_INSTANCE_ID,
|
||||
);
|
||||
|
||||
+2
-2
@@ -2,10 +2,10 @@ import { CommandMenuActionMenuDropdown } from '@/action-menu/components/CommandM
|
||||
import { ActionMenuContextProvider } from '@/action-menu/contexts/ActionMenuContextProvider';
|
||||
import { MAIN_CONTEXT_STORE_INSTANCE_ID } from '@/context-store/constants/MainContextStoreInstanceId';
|
||||
import { contextStoreCurrentObjectMetadataItemIdComponentState } from '@/context-store/states/contextStoreCurrentObjectMetadataItemIdComponentState';
|
||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2';
|
||||
import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';
|
||||
|
||||
export const RecordShowRightDrawerActionMenu = () => {
|
||||
const contextStoreCurrentObjectMetadataItemId = useRecoilComponentValueV2(
|
||||
const contextStoreCurrentObjectMetadataItemId = useAtomComponentStateValue(
|
||||
contextStoreCurrentObjectMetadataItemIdComponentState,
|
||||
MAIN_CONTEXT_STORE_INSTANCE_ID,
|
||||
);
|
||||
|
||||
+8
-8
@@ -14,11 +14,11 @@ import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTab
|
||||
import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement';
|
||||
import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow';
|
||||
import { useComponentInstanceStateContext } from '@/ui/utilities/state/component-state/hooks/useComponentInstanceStateContext';
|
||||
import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2';
|
||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2';
|
||||
import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2';
|
||||
import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState';
|
||||
import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';
|
||||
import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState';
|
||||
import { t } from '@lingui/core/macro';
|
||||
import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2';
|
||||
import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue';
|
||||
import { useStore } from 'jotai';
|
||||
import { useCallback } from 'react';
|
||||
import { AppPath } from 'twenty-shared/types';
|
||||
@@ -37,7 +37,7 @@ export const RecordShowRightDrawerOpenRecordButton = ({
|
||||
objectNameSingular,
|
||||
recordId,
|
||||
}: RecordShowRightDrawerOpenRecordButtonProps) => {
|
||||
const record = useFamilyRecoilValueV2(recordStoreFamilyState, recordId) as
|
||||
const record = useAtomFamilyStateValue(recordStoreFamilyState, recordId) as
|
||||
| ObjectRecord
|
||||
| null
|
||||
| undefined;
|
||||
@@ -52,7 +52,7 @@ export const RecordShowRightDrawerOpenRecordButton = ({
|
||||
targetObjectId: recordId,
|
||||
});
|
||||
|
||||
const activeTabIdInRightDrawer = useRecoilComponentValueV2(
|
||||
const activeTabIdInRightDrawer = useAtomComponentStateValue(
|
||||
activeTabIdComponentState,
|
||||
tabListComponentId,
|
||||
);
|
||||
@@ -61,12 +61,12 @@ export const RecordShowRightDrawerOpenRecordButton = ({
|
||||
targetObjectId: recordId,
|
||||
});
|
||||
|
||||
const setActiveTabIdInRecordPage = useSetRecoilComponentStateV2(
|
||||
const setActiveTabIdInRecordPage = useSetAtomComponentState(
|
||||
activeTabIdComponentState,
|
||||
tabListComponentIdInRecordPage,
|
||||
);
|
||||
|
||||
const parentViewState = useRecoilComponentStateCallbackStateV2(
|
||||
const parentViewState = useAtomComponentStateCallbackState(
|
||||
contextStoreRecordShowParentViewComponentState,
|
||||
MAIN_CONTEXT_STORE_INSTANCE_ID,
|
||||
);
|
||||
|
||||
+4
-4
@@ -6,8 +6,8 @@ import { contextStoreCurrentObjectMetadataItemIdComponentState } from '@/context
|
||||
import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState';
|
||||
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||
import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';
|
||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2';
|
||||
import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2';
|
||||
import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';
|
||||
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
export const ActionMenuContextProvider = ({
|
||||
@@ -20,12 +20,12 @@ export const ActionMenuContextProvider = ({
|
||||
children: React.ReactNode;
|
||||
objectMetadataItemOverride?: ObjectMetadataItem;
|
||||
}) => {
|
||||
const contextStoreCurrentObjectMetadataItemId = useRecoilComponentValueV2(
|
||||
const contextStoreCurrentObjectMetadataItemId = useAtomComponentStateValue(
|
||||
contextStoreCurrentObjectMetadataItemIdComponentState,
|
||||
MAIN_CONTEXT_STORE_INSTANCE_ID,
|
||||
);
|
||||
|
||||
const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState);
|
||||
const objectMetadataItems = useAtomStateValue(objectMetadataItemsState);
|
||||
|
||||
const objectMetadataItem =
|
||||
objectMetadataItemOverride ??
|
||||
|
||||
+2
-2
@@ -10,7 +10,7 @@ import { useCommandMenuItemFrontComponentActions } from '@/command-menu-item/hoo
|
||||
import { MAIN_CONTEXT_STORE_INSTANCE_ID } from '@/context-store/constants/MainContextStoreInstanceId';
|
||||
import { contextStoreTargetedRecordsRuleComponentState } from '@/context-store/states/contextStoreTargetedRecordsRuleComponentState';
|
||||
import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';
|
||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2';
|
||||
import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';
|
||||
|
||||
export const ActionMenuContextProviderDefault = ({
|
||||
objectMetadataItem,
|
||||
@@ -35,7 +35,7 @@ export const ActionMenuContextProviderDefault = ({
|
||||
|
||||
const actions = useRegisteredActions(shouldBeRegisteredParams);
|
||||
|
||||
const contextStoreTargetedRecordsRule = useRecoilComponentValueV2(
|
||||
const contextStoreTargetedRecordsRule = useAtomComponentStateValue(
|
||||
contextStoreTargetedRecordsRuleComponentState,
|
||||
MAIN_CONTEXT_STORE_INSTANCE_ID,
|
||||
);
|
||||
|
||||
+5
-4
@@ -10,8 +10,8 @@ import { MAIN_CONTEXT_STORE_INSTANCE_ID } from '@/context-store/constants/MainCo
|
||||
import { contextStoreTargetedRecordsRuleComponentState } from '@/context-store/states/contextStoreTargetedRecordsRuleComponentState';
|
||||
import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';
|
||||
import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState';
|
||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2';
|
||||
import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2';
|
||||
import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';
|
||||
import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue';
|
||||
import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion';
|
||||
import { type WorkflowWithCurrentVersion } from '@/workflow/types/Workflow';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
@@ -123,7 +123,7 @@ export const ActionMenuContextProviderWorkflowObjects = ({
|
||||
actionMenuType,
|
||||
children,
|
||||
}: ActionMenuContextProviderWorkflowObjectsProps) => {
|
||||
const contextStoreTargetedRecordsRule = useRecoilComponentValueV2(
|
||||
const contextStoreTargetedRecordsRule = useAtomComponentStateValue(
|
||||
contextStoreTargetedRecordsRuleComponentState,
|
||||
MAIN_CONTEXT_STORE_INSTANCE_ID,
|
||||
);
|
||||
@@ -135,7 +135,8 @@ export const ActionMenuContextProviderWorkflowObjects = ({
|
||||
: undefined;
|
||||
|
||||
const selectedRecord =
|
||||
useFamilyRecoilValueV2(recordStoreFamilyState, recordId ?? '') || undefined;
|
||||
useAtomFamilyStateValue(recordStoreFamilyState, recordId ?? '') ||
|
||||
undefined;
|
||||
|
||||
if (isDefined(selectedRecord?.id)) {
|
||||
return (
|
||||
|
||||
@@ -10,7 +10,7 @@ import { contextStoreIsPageInEditModeComponentState } from '@/context-store/stat
|
||||
import { contextStoreTargetedRecordsRuleComponentState } from '@/context-store/states/contextStoreTargetedRecordsRuleComponentState';
|
||||
import { useRecordIndexIdFromCurrentContextStore } from '@/object-record/record-index/hooks/useRecordIndexIdFromCurrentContextStore';
|
||||
import { usePermissionFlagMap } from '@/settings/roles/hooks/usePermissionFlagMap';
|
||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2';
|
||||
import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { useIcons } from 'twenty-ui/display';
|
||||
|
||||
@@ -22,19 +22,19 @@ export const useRegisteredActions = (
|
||||
|
||||
const { getIcon } = useIcons();
|
||||
|
||||
const contextStoreTargetedRecordsRule = useRecoilComponentValueV2(
|
||||
const contextStoreTargetedRecordsRule = useAtomComponentStateValue(
|
||||
contextStoreTargetedRecordsRuleComponentState,
|
||||
MAIN_CONTEXT_STORE_INSTANCE_ID,
|
||||
);
|
||||
|
||||
const contextStoreCurrentViewType = useRecoilComponentValueV2(
|
||||
const contextStoreCurrentViewType = useAtomComponentStateValue(
|
||||
contextStoreCurrentViewTypeComponentState,
|
||||
MAIN_CONTEXT_STORE_INSTANCE_ID,
|
||||
);
|
||||
|
||||
const { recordIndexId } = useRecordIndexIdFromCurrentContextStore();
|
||||
|
||||
const isFullTabWidgetInEditMode = useRecoilComponentValueV2(
|
||||
const isFullTabWidgetInEditMode = useAtomComponentStateValue(
|
||||
contextStoreIsPageInEditModeComponentState,
|
||||
recordIndexId,
|
||||
);
|
||||
|
||||
+13
-12
@@ -17,10 +17,10 @@ import { useRecordIndexIdFromCurrentContextStore } from '@/object-record/record-
|
||||
import { useObjectPermissionsForObject } from '@/object-record/hooks/useObjectPermissionsForObject';
|
||||
import { hasAnySoftDeleteFilterOnViewComponentSelector } from '@/object-record/record-filter/states/hasAnySoftDeleteFilterOnView';
|
||||
import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState';
|
||||
import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2';
|
||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2';
|
||||
import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2';
|
||||
import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2';
|
||||
import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue';
|
||||
import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';
|
||||
import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue';
|
||||
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
|
||||
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
||||
import { useCallback, useContext, useMemo } from 'react';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
@@ -39,7 +39,7 @@ export const useShouldActionBeRegisteredParams = ({
|
||||
FeatureFlagKey.IS_NAVIGATION_MENU_ITEM_EDITING_ENABLED,
|
||||
);
|
||||
|
||||
const contextStoreTargetedRecordsRule = useRecoilComponentValueV2(
|
||||
const contextStoreTargetedRecordsRule = useAtomComponentStateValue(
|
||||
contextStoreTargetedRecordsRuleComponentState,
|
||||
MAIN_CONTEXT_STORE_INSTANCE_ID,
|
||||
);
|
||||
@@ -76,7 +76,8 @@ export const useShouldActionBeRegisteredParams = ({
|
||||
]);
|
||||
|
||||
const selectedRecord =
|
||||
useFamilyRecoilValueV2(recordStoreFamilyState, recordId ?? '') || undefined;
|
||||
useAtomFamilyStateValue(recordStoreFamilyState, recordId ?? '') ||
|
||||
undefined;
|
||||
|
||||
const objectPermissions = useObjectPermissionsForObject(
|
||||
objectMetadataItem?.id ?? '',
|
||||
@@ -90,23 +91,23 @@ export const useShouldActionBeRegisteredParams = ({
|
||||
|
||||
const { recordIndexId } = useRecordIndexIdFromCurrentContextStore();
|
||||
|
||||
const hasAnySoftDeleteFilterOnView = useRecoilComponentSelectorValueV2(
|
||||
const hasAnySoftDeleteFilterOnView = useAtomComponentSelectorValue(
|
||||
hasAnySoftDeleteFilterOnViewComponentSelector,
|
||||
recordIndexId,
|
||||
);
|
||||
|
||||
const isShowPage =
|
||||
useRecoilComponentValueV2(
|
||||
useAtomComponentStateValue(
|
||||
contextStoreCurrentViewTypeComponentState,
|
||||
MAIN_CONTEXT_STORE_INSTANCE_ID,
|
||||
) === ContextStoreViewType.ShowPage;
|
||||
|
||||
const numberOfSelectedRecords = useRecoilComponentValueV2(
|
||||
const numberOfSelectedRecords = useAtomComponentStateValue(
|
||||
contextStoreNumberOfSelectedRecordsComponentState,
|
||||
MAIN_CONTEXT_STORE_INSTANCE_ID,
|
||||
);
|
||||
|
||||
const contextStoreCurrentViewType = useRecoilComponentValueV2(
|
||||
const contextStoreCurrentViewType = useAtomComponentStateValue(
|
||||
contextStoreCurrentViewTypeComponentState,
|
||||
MAIN_CONTEXT_STORE_INSTANCE_ID,
|
||||
);
|
||||
@@ -140,11 +141,11 @@ export const useShouldActionBeRegisteredParams = ({
|
||||
[store],
|
||||
);
|
||||
|
||||
const forceRegisteredActionsByKey = useRecoilValueV2(
|
||||
const forceRegisteredActionsByKey = useAtomStateValue(
|
||||
forceRegisteredActionsByKeyState,
|
||||
);
|
||||
|
||||
const currentWorkspace = useRecoilValueV2(currentWorkspaceState);
|
||||
const currentWorkspace = useAtomStateValue(currentWorkspaceState);
|
||||
|
||||
const isFeatureFlagEnabled = (featureFlagKey: FeatureFlagKey) => {
|
||||
const featureFlag = currentWorkspace?.featureFlags?.find(
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
import { ActionMenuComponentInstanceContext } from '@/action-menu/states/contexts/ActionMenuComponentInstanceContext';
|
||||
import { type PositionType } from '@/action-menu/types/PositionType';
|
||||
import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2';
|
||||
import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState';
|
||||
|
||||
export const recordIndexActionMenuDropdownPositionComponentState =
|
||||
createComponentStateV2<PositionType>({
|
||||
createAtomComponentState<PositionType>({
|
||||
key: 'recordIndexActionMenuDropdownPositionComponentState',
|
||||
defaultValue: {
|
||||
x: null,
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@ import { css, useTheme } from '@emotion/react';
|
||||
import styled from '@emotion/styled';
|
||||
import { t } from '@lingui/core/macro';
|
||||
import { format } from 'date-fns';
|
||||
import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2';
|
||||
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
|
||||
import {
|
||||
CalendarChannelVisibility,
|
||||
type TimelineCalendarEvent,
|
||||
@@ -85,7 +85,7 @@ export const CalendarEventRow = ({
|
||||
className,
|
||||
}: CalendarEventRowProps) => {
|
||||
const theme = useTheme();
|
||||
const currentWorkspaceMember = useRecoilValueV2(currentWorkspaceMemberState);
|
||||
const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState);
|
||||
const { openCalendarEventInCommandMenu } =
|
||||
useOpenCalendarEventInCommandMenu();
|
||||
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2';
|
||||
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
|
||||
import styled from '@emotion/styled';
|
||||
import { useLingui } from '@lingui/react/macro';
|
||||
import { format, getYear } from 'date-fns';
|
||||
@@ -49,7 +49,7 @@ const StyledTitleContainer = styled.div`
|
||||
export const CalendarEventsCard = () => {
|
||||
const { t } = useLingui();
|
||||
const targetRecord = useTargetRecord();
|
||||
const { localeCatalog } = useRecoilValueV2(dateLocaleState);
|
||||
const { localeCatalog } = useAtomStateValue(dateLocaleState);
|
||||
|
||||
const [query, queryName] =
|
||||
targetRecord.targetObjectNameSingular === CoreObjectNameSingular.Person
|
||||
|
||||
@@ -5,7 +5,7 @@ import { v4 } from 'uuid';
|
||||
import { useUploadAttachmentFile } from '@/activities/files/hooks/useUploadAttachmentFile';
|
||||
import { useUpsertActivity } from '@/activities/hooks/useUpsertActivity';
|
||||
import { canCreateActivityState } from '@/activities/states/canCreateActivityState';
|
||||
import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2';
|
||||
import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';
|
||||
import { getActivityTargetObjectFieldIdName } from '@/activities/utils/getActivityTargetObjectFieldIdName';
|
||||
import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';
|
||||
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||
@@ -126,7 +126,7 @@ export const ActivityRichTextEditor = ({
|
||||
}
|
||||
}, 300);
|
||||
|
||||
const [canCreateActivity, setCanCreateActivity] = useRecoilStateV2(
|
||||
const [canCreateActivity, setCanCreateActivity] = useAtomState(
|
||||
canCreateActivityState,
|
||||
);
|
||||
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2';
|
||||
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
|
||||
import styled from '@emotion/styled';
|
||||
import { t } from '@lingui/core/macro';
|
||||
|
||||
@@ -43,7 +43,7 @@ export const EmailThreadHeader = ({
|
||||
subject,
|
||||
lastMessageSentAt,
|
||||
}: EmailThreadHeaderProps) => {
|
||||
const { localeCatalog } = useRecoilValueV2(dateLocaleState);
|
||||
const { localeCatalog } = useAtomStateValue(dateLocaleState);
|
||||
const lastMessageSentAtFormatted = beautifyPastDateRelativeToNow(
|
||||
lastMessageSentAt,
|
||||
localeCatalog,
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@ import styled from '@emotion/styled';
|
||||
|
||||
import { ParticipantChip } from '@/activities/components/ParticipantChip';
|
||||
import { type EmailThreadMessageParticipant } from '@/activities/emails/types/EmailThreadMessageParticipant';
|
||||
import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2';
|
||||
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
|
||||
import { AppTooltip, TooltipPosition } from 'twenty-ui/display';
|
||||
import { dateLocaleState } from '~/localization/states/dateLocaleState';
|
||||
import {
|
||||
@@ -31,7 +31,7 @@ export const EmailThreadMessageSender = ({
|
||||
sender,
|
||||
sentAt,
|
||||
}: EmailThreadMessageSenderProps) => {
|
||||
const { localeCatalog } = useRecoilValueV2(dateLocaleState);
|
||||
const { localeCatalog } = useAtomStateValue(dateLocaleState);
|
||||
const tooltipId = `date-tooltip-${sentAt.replace(/[^a-zA-Z0-9]/g, '-')}`;
|
||||
|
||||
return (
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2';
|
||||
export const emailThreadIdWhenEmailThreadWasClosedState = createStateV2<
|
||||
import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState';
|
||||
export const emailThreadIdWhenEmailThreadWasClosedState = createAtomState<
|
||||
string | null
|
||||
>({
|
||||
key: 'emailThreadIdWhenEmailThreadWasClosedState',
|
||||
|
||||
@@ -11,7 +11,7 @@ import { type ActivityTargetableObject } from '@/activities/types/ActivityTarget
|
||||
import { isAttachmentPreviewEnabledState } from '@/client-config/states/isAttachmentPreviewEnabledState';
|
||||
import { Modal } from '@/ui/layout/modal/components/Modal';
|
||||
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
||||
import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2';
|
||||
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
|
||||
|
||||
import { ActivityList } from '@/activities/components/ActivityList';
|
||||
import { useHasPermissionFlag } from '@/settings/roles/hooks/useHasPermissionFlag';
|
||||
@@ -135,7 +135,7 @@ export const AttachmentList = ({
|
||||
const [previewedAttachment, setPreviewedAttachment] =
|
||||
useState<Attachment | null>(null);
|
||||
|
||||
const isAttachmentPreviewEnabled = useRecoilValueV2(
|
||||
const isAttachmentPreviewEnabled = useAtomStateValue(
|
||||
isAttachmentPreviewEnabledState,
|
||||
);
|
||||
|
||||
|
||||
+2
-2
@@ -9,7 +9,7 @@ import { useActivityTargetObjectRecords } from '@/activities/hooks/useActivityTa
|
||||
import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState';
|
||||
import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState';
|
||||
import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState';
|
||||
import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2';
|
||||
import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState';
|
||||
import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore';
|
||||
import { SnackBarComponentInstanceContext } from '@/ui/feedback/snack-bar-manager/contexts/SnackBarComponentInstanceContext';
|
||||
import { JestObjectMetadataItemSetter } from '~/testing/jest/JestObjectMetadataItemSetter';
|
||||
@@ -140,7 +140,7 @@ describe('useActivityTargetObjectRecords', () => {
|
||||
|
||||
const { result } = renderHook(
|
||||
() => {
|
||||
const setRecordFromStore = useSetFamilyRecoilStateV2(
|
||||
const setRecordFromStore = useSetAtomFamilyState(
|
||||
recordStoreFamilyState,
|
||||
task.id,
|
||||
);
|
||||
|
||||
+2
-2
@@ -5,7 +5,7 @@ import { useOpenCreateActivityDrawer } from '@/activities/hooks/useOpenCreateAct
|
||||
import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState';
|
||||
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||
import { viewableRecordIdState } from '@/object-record/record-right-drawer/states/viewableRecordIdState';
|
||||
import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2';
|
||||
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
|
||||
import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore';
|
||||
import gql from 'graphql-tag';
|
||||
import { getJestMetadataAndApolloMocksWrapper } from '~/testing/jest/getJestMetadataAndApolloMocksWrapper';
|
||||
@@ -83,7 +83,7 @@ describe('useOpenCreateActivityDrawer', () => {
|
||||
const openActivityRightDrawer = useOpenCreateActivityDrawer({
|
||||
activityObjectNameSingular: CoreObjectNameSingular.Note,
|
||||
});
|
||||
const viewableRecordId = useRecoilValueV2(viewableRecordIdState);
|
||||
const viewableRecordId = useAtomStateValue(viewableRecordIdState);
|
||||
return {
|
||||
openActivityRightDrawer,
|
||||
viewableRecordId,
|
||||
|
||||
+4
-4
@@ -5,8 +5,8 @@ import { type TaskTarget } from '@/activities/types/TaskTarget';
|
||||
import { getActivityTargetObjectRecords } from '@/activities/utils/getActivityTargetObjectRecords';
|
||||
import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState';
|
||||
import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState';
|
||||
import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2';
|
||||
import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2';
|
||||
import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue';
|
||||
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
|
||||
import { type Nullable } from 'twenty-shared/types';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
@@ -14,9 +14,9 @@ export const useActivityTargetObjectRecords = (
|
||||
activityRecordId?: string,
|
||||
activityTargets?: Nullable<NoteTarget[] | TaskTarget[]>,
|
||||
) => {
|
||||
const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState);
|
||||
const objectMetadataItems = useAtomStateValue(objectMetadataItemsState);
|
||||
|
||||
const activity = useFamilyRecoilValueV2(
|
||||
const activity = useAtomFamilyStateValue(
|
||||
recordStoreFamilyState,
|
||||
activityRecordId ?? '',
|
||||
) as Note | Task | null;
|
||||
|
||||
+2
-2
@@ -9,7 +9,7 @@ import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadat
|
||||
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||
import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';
|
||||
import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords';
|
||||
import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2';
|
||||
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
|
||||
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
||||
|
||||
import { FeatureFlagKey } from '~/generated-metadata/graphql';
|
||||
@@ -32,7 +32,7 @@ export const useActivityTargetsForTargetableObjects = ({
|
||||
activityTargetsOrderByVariables: RecordGqlOperationOrderBy;
|
||||
limit: number;
|
||||
}) => {
|
||||
const objectMetadataItems = useRecoilValueV2<ObjectMetadataItem[]>(
|
||||
const objectMetadataItems = useAtomStateValue<ObjectMetadataItem[]>(
|
||||
objectMetadataItemsState,
|
||||
);
|
||||
const isNoteTargetMigrated = useIsFeatureEnabled(
|
||||
|
||||
@@ -5,7 +5,7 @@ import { viewableRecordNameSingularState } from '@/object-record/record-right-dr
|
||||
import { type WorkspaceMember } from '@/workspace-member/types/WorkspaceMember';
|
||||
|
||||
import { isUpsertingActivityInDBState } from '@/activities/states/isCreatingActivityInDBState';
|
||||
import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2';
|
||||
import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';
|
||||
import { type ActivityTargetableObject } from '@/activities/types/ActivityTargetableEntity';
|
||||
import { type Note } from '@/activities/types/Note';
|
||||
import { type NoteTarget } from '@/activities/types/NoteTarget';
|
||||
@@ -39,15 +39,15 @@ export const useOpenCreateActivityDrawer = ({
|
||||
shouldMatchRootQueryFilter: true,
|
||||
});
|
||||
|
||||
const setActivityTargetableEntityArray = useSetRecoilStateV2(
|
||||
const setActivityTargetableEntityArray = useSetAtomState(
|
||||
activityTargetableEntityArrayState,
|
||||
);
|
||||
const setViewableRecordId = useSetRecoilStateV2(viewableRecordIdState);
|
||||
const setViewableRecordNameSingular = useSetRecoilStateV2(
|
||||
const setViewableRecordId = useSetAtomState(viewableRecordIdState);
|
||||
const setViewableRecordNameSingular = useSetAtomState(
|
||||
viewableRecordNameSingularState,
|
||||
);
|
||||
|
||||
const setIsUpsertingActivityInDB = useSetRecoilStateV2(
|
||||
const setIsUpsertingActivityInDB = useSetAtomState(
|
||||
isUpsertingActivityInDBState,
|
||||
);
|
||||
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
import { usePrepareFindManyActivitiesQuery } from '@/activities/hooks/usePrepareFindManyActivitiesQuery';
|
||||
import { objectShowPageTargetableObjectStateV2 } from '@/activities/timeline-activities/states/objectShowPageTargetableObjectStateV2';
|
||||
import { type CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||
import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2';
|
||||
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
// This hook should only be executed if the normalized cache is up-to-date
|
||||
@@ -12,7 +12,7 @@ export const useRefreshShowPageFindManyActivitiesQueries = ({
|
||||
}: {
|
||||
activityObjectNameSingular: CoreObjectNameSingular;
|
||||
}) => {
|
||||
const objectShowPageTargetableObject = useRecoilValueV2(
|
||||
const objectShowPageTargetableObject = useAtomStateValue(
|
||||
objectShowPageTargetableObjectStateV2,
|
||||
);
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@ import { type Task } from '@/activities/types/Task';
|
||||
import { type CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||
import { useUpdateOneRecord } from '@/object-record/hooks/useUpdateOneRecord';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2';
|
||||
import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2';
|
||||
import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';
|
||||
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
|
||||
|
||||
export const useUpsertActivity = ({
|
||||
activityObjectNameSingular,
|
||||
@@ -18,9 +18,7 @@ export const useUpsertActivity = ({
|
||||
| CoreObjectNameSingular.Task
|
||||
| CoreObjectNameSingular.Note;
|
||||
}) => {
|
||||
const [isActivityInCreateMode] = useRecoilStateV2(
|
||||
isActivityInCreateModeState,
|
||||
);
|
||||
const [isActivityInCreateMode] = useAtomState(isActivityInCreateModeState);
|
||||
|
||||
const { updateOneRecord: updateOneActivity } = useUpdateOneRecord();
|
||||
|
||||
@@ -28,11 +26,11 @@ export const useUpsertActivity = ({
|
||||
activityObjectNameSingular,
|
||||
});
|
||||
|
||||
const [, setIsUpsertingActivityInDB] = useRecoilStateV2(
|
||||
const [, setIsUpsertingActivityInDB] = useAtomState(
|
||||
isUpsertingActivityInDBState,
|
||||
);
|
||||
|
||||
const objectShowPageTargetableObject = useRecoilValueV2(
|
||||
const objectShowPageTargetableObject = useAtomStateValue(
|
||||
objectShowPageTargetableObjectStateV2,
|
||||
);
|
||||
|
||||
|
||||
+2
-2
@@ -10,7 +10,7 @@ import { useDeleteOneRecord } from '@/object-record/hooks/useDeleteOneRecord';
|
||||
import { searchRecordStoreFamilyState } from '@/object-record/record-picker/multiple-record-picker/states/searchRecordStoreComponentFamilyState';
|
||||
import { type RecordPickerPickableMorphItem } from '@/object-record/record-picker/types/RecordPickerPickableMorphItem';
|
||||
import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState';
|
||||
import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2';
|
||||
import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState';
|
||||
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
||||
import { useCallback } from 'react';
|
||||
import { useStore } from 'jotai';
|
||||
@@ -66,7 +66,7 @@ export const useUpdateActivityTargetFromCell = ({
|
||||
: isNoteTargetMigrated;
|
||||
|
||||
const store = useStore();
|
||||
const setActivityFromStore = useSetFamilyRecoilStateV2(
|
||||
const setActivityFromStore = useSetAtomFamilyState(
|
||||
recordStoreFamilyState,
|
||||
activityId,
|
||||
);
|
||||
|
||||
@@ -9,7 +9,7 @@ import { isDeeplyEqual } from '~/utils/isDeeplyEqual';
|
||||
|
||||
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||
import { type ActivityTargetableObject } from '@/activities/types/ActivityTargetableEntity';
|
||||
import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2';
|
||||
import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';
|
||||
|
||||
export const useNotes = (targetableObject: ActivityTargetableObject) => {
|
||||
const notesQueryVariables = useMemo(
|
||||
@@ -34,7 +34,7 @@ export const useNotes = (targetableObject: ActivityTargetableObject) => {
|
||||
});
|
||||
|
||||
const [currentNotesQueryVariables, setCurrentNotesQueryVariables] =
|
||||
useRecoilStateV2(currentNotesQueryVariablesStateV2);
|
||||
useAtomState(currentNotesQueryVariablesStateV2);
|
||||
|
||||
// TODO: fix useEffect, remove with better pattern
|
||||
useEffect(() => {
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
import { type RecordGqlOperationVariables } from 'twenty-shared/types';
|
||||
|
||||
import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2';
|
||||
import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState';
|
||||
|
||||
export const currentNotesQueryVariablesStateV2 =
|
||||
createStateV2<RecordGqlOperationVariables | null>({
|
||||
createAtomState<RecordGqlOperationVariables | null>({
|
||||
key: 'currentNotesQueryVariablesStateV2',
|
||||
defaultValue: null,
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createFamilyStateV2';
|
||||
import { createAtomFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomFamilyState';
|
||||
|
||||
export const activityBodyFamilyState = createFamilyStateV2<
|
||||
export const activityBodyFamilyState = createAtomFamilyState<
|
||||
string,
|
||||
{ activityId: string }
|
||||
>({
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
import { type ActivityTargetableObject } from '@/activities/types/ActivityTargetableEntity';
|
||||
import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2';
|
||||
import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState';
|
||||
|
||||
export const activityTargetableEntityArrayState = createStateV2<
|
||||
export const activityTargetableEntityArrayState = createAtomState<
|
||||
ActivityTargetableObject[]
|
||||
>({
|
||||
key: 'activities/targetable-entity-array',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2';
|
||||
export const canCreateActivityState = createStateV2<boolean>({
|
||||
import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState';
|
||||
export const canCreateActivityState = createAtomState<boolean>({
|
||||
key: 'canCreateActivityState',
|
||||
defaultValue: false,
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2';
|
||||
export const isActivityInCreateModeState = createStateV2<boolean>({
|
||||
import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState';
|
||||
export const isActivityInCreateModeState = createAtomState<boolean>({
|
||||
key: 'isActivityInCreateModeState',
|
||||
defaultValue: false,
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2';
|
||||
export const isUpsertingActivityInDBState = createStateV2<boolean>({
|
||||
import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState';
|
||||
export const isUpsertingActivityInDBState = createAtomState<boolean>({
|
||||
key: 'isUpsertingActivityInDBState',
|
||||
defaultValue: false,
|
||||
});
|
||||
|
||||
@@ -9,7 +9,7 @@ import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadata
|
||||
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||
import { useObjectPermissionsForObject } from '@/object-record/hooks/useObjectPermissionsForObject';
|
||||
import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState';
|
||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2';
|
||||
import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';
|
||||
import { t } from '@lingui/core/macro';
|
||||
import groupBy from 'lodash.groupby';
|
||||
import { IconPlus } from 'twenty-ui/display';
|
||||
@@ -55,7 +55,7 @@ export const TaskGroups = ({ targetableObject }: TaskGroupsProps) => {
|
||||
activityObjectNameSingular: CoreObjectNameSingular.Task,
|
||||
});
|
||||
|
||||
const activeTabId = useRecoilComponentValueV2(activeTabIdComponentState);
|
||||
const activeTabId = useAtomComponentStateValue(activeTabIdComponentState);
|
||||
|
||||
const isLoading =
|
||||
(activeTabId !== 'done' && tasksLoading) ||
|
||||
|
||||
+6
-6
@@ -1,5 +1,5 @@
|
||||
import styled from '@emotion/styled';
|
||||
import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2';
|
||||
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
|
||||
import { useContext } from 'react';
|
||||
|
||||
import { TimelineActivityContext } from '@/activities/timeline-activities/contexts/TimelineActivityContext';
|
||||
@@ -13,7 +13,7 @@ import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMembe
|
||||
import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';
|
||||
import { getObjectRecordIdentifier } from '@/object-metadata/utils/getObjectRecordIdentifier';
|
||||
import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState';
|
||||
import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2';
|
||||
import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue';
|
||||
import { dateLocaleState } from '~/localization/states/dateLocaleState';
|
||||
import { beautifyPastDateRelativeToNow } from '~/utils/date-utils';
|
||||
import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull';
|
||||
@@ -93,17 +93,17 @@ export const EventRow = ({
|
||||
event,
|
||||
mainObjectMetadataItem,
|
||||
}: EventRowProps) => {
|
||||
const currentWorkspaceMember = useRecoilValueV2(currentWorkspaceMemberState);
|
||||
const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState);
|
||||
|
||||
const allowRequestsToTwentyIcons = useRecoilValueV2(
|
||||
const allowRequestsToTwentyIcons = useAtomStateValue(
|
||||
allowRequestsToTwentyIconsState,
|
||||
);
|
||||
|
||||
const { localeCatalog } = useRecoilValueV2(dateLocaleState);
|
||||
const { localeCatalog } = useAtomStateValue(dateLocaleState);
|
||||
|
||||
const { recordId } = useContext(TimelineActivityContext);
|
||||
|
||||
const recordFromStore = useFamilyRecoilValueV2(
|
||||
const recordFromStore = useAtomFamilyStateValue(
|
||||
recordStoreFamilyState,
|
||||
recordId,
|
||||
);
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState';
|
||||
import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';
|
||||
import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2';
|
||||
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
|
||||
|
||||
export const useLinkedObjectObjectMetadataItem = (id: string | null) => {
|
||||
const objectMetadataItems: ObjectMetadataItem[] = useRecoilValueV2(
|
||||
const objectMetadataItems: ObjectMetadataItem[] = useAtomStateValue(
|
||||
objectMetadataItemsState,
|
||||
);
|
||||
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ import { useEffect } from 'react';
|
||||
import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem';
|
||||
import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';
|
||||
import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState';
|
||||
import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2';
|
||||
import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
export const EventFieldDiffValueEffect = ({
|
||||
@@ -17,7 +17,7 @@ export const EventFieldDiffValueEffect = ({
|
||||
mainObjectMetadataItem: ObjectMetadataItem;
|
||||
fieldMetadataItem: FieldMetadataItem;
|
||||
}) => {
|
||||
const setEntity = useSetFamilyRecoilStateV2(
|
||||
const setEntity = useSetAtomFamilyState(
|
||||
recordStoreFamilyState,
|
||||
diffArtificialRecordStoreId,
|
||||
);
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
import { type ActivityTargetableObject } from '@/activities/types/ActivityTargetableEntity';
|
||||
|
||||
import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2';
|
||||
import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState';
|
||||
|
||||
export const objectShowPageTargetableObjectStateV2 =
|
||||
createStateV2<ActivityTargetableObject | null>({
|
||||
createAtomState<ActivityTargetableObject | null>({
|
||||
key: 'objectShowPageTargetableObjectStateV2',
|
||||
defaultValue: null,
|
||||
});
|
||||
|
||||
@@ -6,7 +6,7 @@ import { AgentMessageRole } from '@/ai/constants/AgentMessageRole';
|
||||
import { AIChatAssistantMessageRenderer } from '@/ai/components/AIChatAssistantMessageRenderer';
|
||||
import { AIChatErrorRenderer } from '@/ai/components/AIChatErrorRenderer';
|
||||
import { LightCopyIconButton } from '@/object-record/record-field/ui/components/LightCopyIconButton';
|
||||
import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2';
|
||||
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
|
||||
import { type ExtendedUIMessage } from 'twenty-shared/ai';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { dateLocaleState } from '~/localization/states/dateLocaleState';
|
||||
@@ -141,7 +141,7 @@ export const AIChatMessage = ({
|
||||
isLastMessageStreaming: boolean;
|
||||
error?: Error | null;
|
||||
}) => {
|
||||
const { localeCatalog } = useRecoilValueV2(dateLocaleState);
|
||||
const { localeCatalog } = useAtomStateValue(dateLocaleState);
|
||||
|
||||
const isUser = message.role === AgentMessageRole.USER;
|
||||
const showError =
|
||||
|
||||
@@ -22,7 +22,7 @@ import { useAIChatFileUpload } from '@/ai/hooks/useAIChatFileUpload';
|
||||
import { useAgentChatContextOrThrow } from '@/ai/hooks/useAgentChatContextOrThrow';
|
||||
import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
|
||||
import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';
|
||||
import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2';
|
||||
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
|
||||
|
||||
const StyledContainer = styled.div<{ isDraggingFile: boolean }>`
|
||||
background: ${({ theme }) => theme.background.primary};
|
||||
@@ -144,7 +144,7 @@ export const AIChatTab = () => {
|
||||
const hasMessages = messages.length > 0;
|
||||
|
||||
const { uploadFiles } = useAIChatFileUpload();
|
||||
const currentWorkspace = useRecoilValueV2(currentWorkspaceState);
|
||||
const currentWorkspace = useAtomStateValue(currentWorkspaceState);
|
||||
const smartModelLabel = useAiModelLabel(currentWorkspace?.smartModel, false);
|
||||
|
||||
const { editor, handleSendAndClear } = useAIChatEditor({
|
||||
|
||||
@@ -2,8 +2,8 @@ import { agentChatUsageStateV2 } from '@/ai/states/agentChatUsageStateV2';
|
||||
import { currentAIChatThreadStateV2 } from '@/ai/states/currentAIChatThreadStateV2';
|
||||
import { currentAIChatThreadTitleState } from '@/ai/states/currentAIChatThreadTitleState';
|
||||
import { useOpenAskAIPageInCommandMenu } from '@/command-menu/hooks/useOpenAskAIPageInCommandMenu';
|
||||
import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2';
|
||||
import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2';
|
||||
import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';
|
||||
import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';
|
||||
import { useTheme } from '@emotion/react';
|
||||
import styled from '@emotion/styled';
|
||||
import { useLingui } from '@lingui/react/macro';
|
||||
@@ -79,13 +79,11 @@ export const AIChatThreadGroup = ({
|
||||
}) => {
|
||||
const { t } = useLingui();
|
||||
const theme = useTheme();
|
||||
const [, setCurrentAIChatThread] = useRecoilStateV2(
|
||||
currentAIChatThreadStateV2,
|
||||
);
|
||||
const setCurrentAIChatThreadTitle = useSetRecoilStateV2(
|
||||
const [, setCurrentAIChatThread] = useAtomState(currentAIChatThreadStateV2);
|
||||
const setCurrentAIChatThreadTitle = useSetAtomState(
|
||||
currentAIChatThreadTitleState,
|
||||
);
|
||||
const setAgentChatUsage = useSetRecoilStateV2(agentChatUsageStateV2);
|
||||
const setAgentChatUsage = useSetAtomState(agentChatUsageStateV2);
|
||||
const { openAskAIPage } = useOpenAskAIPageInCommandMenu();
|
||||
|
||||
const handleThreadClick = (thread: AgentChatThread) => {
|
||||
|
||||
@@ -26,7 +26,7 @@ import { isThinkingStepPartActive } from '@/ai/utils/isThinkingStepPartActive';
|
||||
import { type ThinkingStepPart } from '@/ai/utils/thinkingStepPart';
|
||||
import { TabList } from '@/ui/layout/tab-list/components/TabList';
|
||||
import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState';
|
||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2';
|
||||
import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';
|
||||
import { useCopyToClipboard } from '~/hooks/useCopyToClipboard';
|
||||
|
||||
const StyledContainer = styled.div`
|
||||
@@ -277,7 +277,7 @@ const ThinkingToolStepRow = ({
|
||||
? unwrappedResult.data.result
|
||||
: unwrappedOutput;
|
||||
const toolTabListComponentInstanceId = `ai-thinking-tool-tabs-${part.toolCallId ?? rawToolName}-${rowIndex}`;
|
||||
const activeToolTabId = useRecoilComponentValueV2(
|
||||
const activeToolTabId = useAtomComponentStateValue(
|
||||
activeTabIdComponentState,
|
||||
toolTabListComponentInstanceId,
|
||||
);
|
||||
|
||||
+2
-2
@@ -13,7 +13,7 @@ import {
|
||||
agentChatUsageStateV2,
|
||||
type AgentChatLastMessageUsage,
|
||||
} from '@/ai/states/agentChatUsageStateV2';
|
||||
import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2';
|
||||
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
|
||||
|
||||
const StyledContainer = styled.div`
|
||||
position: relative;
|
||||
@@ -114,7 +114,7 @@ export const AIChatContextUsageButton = () => {
|
||||
const { t } = useLingui();
|
||||
const theme = useTheme();
|
||||
const [isHovered, setIsHovered] = useState(false);
|
||||
const agentChatUsage = useRecoilValueV2(agentChatUsageStateV2);
|
||||
const agentChatUsage = useAtomStateValue(agentChatUsageStateV2);
|
||||
|
||||
if (!agentChatUsage) {
|
||||
return (
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
import { agentChatSelectedFilesStateV2 } from '@/ai/states/agentChatSelectedFilesStateV2';
|
||||
import { agentChatUploadedFilesStateV2 } from '@/ai/states/agentChatUploadedFilesStateV2';
|
||||
import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2';
|
||||
import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';
|
||||
import styled from '@emotion/styled';
|
||||
import { AgentChatFilePreview } from './AgentChatFilePreview';
|
||||
|
||||
@@ -19,10 +19,10 @@ const StyledPreviewsContainer = styled.div`
|
||||
`;
|
||||
|
||||
export const AgentChatContextPreview = () => {
|
||||
const [agentChatSelectedFiles, setAgentChatSelectedFiles] = useRecoilStateV2(
|
||||
const [agentChatSelectedFiles, setAgentChatSelectedFiles] = useAtomState(
|
||||
agentChatSelectedFilesStateV2,
|
||||
);
|
||||
const [agentChatUploadedFiles, setAgentChatUploadedFiles] = useRecoilStateV2(
|
||||
const [agentChatUploadedFiles, setAgentChatUploadedFiles] = useAtomState(
|
||||
agentChatUploadedFilesStateV2,
|
||||
);
|
||||
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
import { useAIChatFileUpload } from '@/ai/hooks/useAIChatFileUpload';
|
||||
import { agentChatSelectedFilesStateV2 } from '@/ai/states/agentChatSelectedFilesStateV2';
|
||||
import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2';
|
||||
import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';
|
||||
import styled from '@emotion/styled';
|
||||
import { t } from '@lingui/core/macro';
|
||||
import React, { useRef } from 'react';
|
||||
@@ -18,7 +18,7 @@ const StyledFileInput = styled.input`
|
||||
`;
|
||||
|
||||
export const AgentChatFileUploadButton = () => {
|
||||
const setAgentChatSelectedFiles = useSetRecoilStateV2(
|
||||
const setAgentChatSelectedFiles = useSetAtomState(
|
||||
agentChatSelectedFilesStateV2,
|
||||
);
|
||||
const fileInputRef = useRef<HTMLInputElement>(null);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useAgentChatContextOrThrow } from '@/ai/hooks/useAgentChatContextOrThrow';
|
||||
import { agentChatInputStateV2 } from '@/ai/states/agentChatInputStateV2';
|
||||
import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2';
|
||||
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
|
||||
import { IconArrowUp, IconPlayerStop } from 'twenty-ui/display';
|
||||
import { RoundedIconButton } from 'twenty-ui/input';
|
||||
|
||||
@@ -9,7 +9,7 @@ type SendMessageButtonProps = {
|
||||
};
|
||||
|
||||
export const SendMessageButton = ({ onSend }: SendMessageButtonProps) => {
|
||||
const agentChatInput = useRecoilValueV2(agentChatInputStateV2);
|
||||
const agentChatInput = useAtomStateValue(agentChatInputStateV2);
|
||||
const { handleStop, isLoading, isStreaming } = useAgentChatContextOrThrow();
|
||||
|
||||
if (isStreaming) {
|
||||
|
||||
+2
-2
@@ -9,7 +9,7 @@ import {
|
||||
type SuggestedPrompt,
|
||||
} from '@/ai/components/suggested-prompts/default-suggested-prompts';
|
||||
import { agentChatInputStateV2 } from '@/ai/states/agentChatInputStateV2';
|
||||
import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2';
|
||||
import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';
|
||||
|
||||
const StyledContainer = styled.div`
|
||||
display: flex;
|
||||
@@ -43,7 +43,7 @@ export const AIChatSuggestedPrompts = ({
|
||||
editor,
|
||||
}: AIChatSuggestedPromptsProps) => {
|
||||
const { t: resolveMessage } = useLingui();
|
||||
const setAgentChatInput = useSetRecoilStateV2(agentChatInputStateV2);
|
||||
const setAgentChatInput = useSetAtomState(agentChatInputStateV2);
|
||||
|
||||
const handleClick = (prompt: SuggestedPrompt) => {
|
||||
const picked = pickRandom(prompt.prefillPrompts);
|
||||
|
||||
@@ -10,7 +10,7 @@ import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
import { AI_CHAT_INPUT_ID } from '@/ai/constants/AiChatInputId';
|
||||
import { agentChatInputStateV2 } from '@/ai/states/agentChatInputStateV2';
|
||||
import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2';
|
||||
import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';
|
||||
import { MENTION_SUGGESTION_PLUGIN_KEY } from '@/mention/constants/MentionSuggestionPluginKey';
|
||||
import { MentionSuggestion } from '@/mention/extensions/MentionSuggestion';
|
||||
import { MentionTag } from '@/mention/extensions/MentionTag';
|
||||
@@ -25,7 +25,7 @@ type UseAIChatEditorProps = {
|
||||
};
|
||||
|
||||
export const useAIChatEditor = ({ onSendMessage }: UseAIChatEditorProps) => {
|
||||
const setAgentChatInput = useSetRecoilStateV2(agentChatInputStateV2);
|
||||
const setAgentChatInput = useSetAtomState(agentChatInputStateV2);
|
||||
const { searchMentionRecords } = useMentionSearch();
|
||||
const { pushFocusItemToFocusStack } = usePushFocusItemToFocusStack();
|
||||
const { removeFocusItemFromFocusStackById } =
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { agentChatSelectedFilesStateV2 } from '@/ai/states/agentChatSelectedFilesStateV2';
|
||||
import { agentChatUploadedFilesStateV2 } from '@/ai/states/agentChatUploadedFilesStateV2';
|
||||
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
|
||||
import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2';
|
||||
import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';
|
||||
import { useApolloClient } from '@apollo/client';
|
||||
import { useLingui } from '@lingui/react/macro';
|
||||
import { type FileUIPart } from 'ai';
|
||||
@@ -17,10 +17,10 @@ export const useAIChatFileUpload = () => {
|
||||
const [uploadFile] = useUploadFileMutation({ client: apolloClient });
|
||||
const { t } = useLingui();
|
||||
const { enqueueErrorSnackBar } = useSnackBar();
|
||||
const [agentChatSelectedFiles, setAgentChatSelectedFiles] = useRecoilStateV2(
|
||||
const [agentChatSelectedFiles, setAgentChatSelectedFiles] = useAtomState(
|
||||
agentChatSelectedFilesStateV2,
|
||||
);
|
||||
const [agentChatUploadedFiles, setAgentChatUploadedFiles] = useRecoilStateV2(
|
||||
const [agentChatUploadedFiles, setAgentChatUploadedFiles] = useAtomState(
|
||||
agentChatUploadedFilesStateV2,
|
||||
);
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@ import { currentAIChatThreadStateV2 } from '@/ai/states/currentAIChatThreadState
|
||||
import { currentAIChatThreadTitleState } from '@/ai/states/currentAIChatThreadTitleState';
|
||||
|
||||
import { agentChatInputStateV2 } from '@/ai/states/agentChatInputStateV2';
|
||||
import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2';
|
||||
import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2';
|
||||
import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2';
|
||||
import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';
|
||||
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
|
||||
import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';
|
||||
import { REST_API_BASE_URL } from '@/apollo/constant/rest-api-base-url';
|
||||
import { getTokenPair } from '@/apollo/utils/getTokenPair';
|
||||
import { renewToken } from '@/auth/services/AuthService';
|
||||
@@ -21,25 +21,25 @@ import { REACT_APP_SERVER_BASE_URL } from '~/config';
|
||||
import { cookieStorage } from '~/utils/cookie-storage';
|
||||
|
||||
export const useAgentChat = (uiMessages: ExtendedUIMessage[]) => {
|
||||
const setTokenPair = useSetRecoilStateV2(tokenPairState);
|
||||
const setAgentChatUsage = useSetRecoilStateV2(agentChatUsageStateV2);
|
||||
const setTokenPair = useSetAtomState(tokenPairState);
|
||||
const setAgentChatUsage = useSetAtomState(agentChatUsageStateV2);
|
||||
|
||||
const { getBrowsingContext } = useGetBrowsingContext();
|
||||
const setCurrentAIChatThreadTitle = useSetRecoilStateV2(
|
||||
const setCurrentAIChatThreadTitle = useSetAtomState(
|
||||
currentAIChatThreadTitleState,
|
||||
);
|
||||
|
||||
const agentChatSelectedFiles = useRecoilValueV2(
|
||||
const agentChatSelectedFiles = useAtomStateValue(
|
||||
agentChatSelectedFilesStateV2,
|
||||
);
|
||||
|
||||
const currentAIChatThread = useRecoilValueV2(currentAIChatThreadStateV2);
|
||||
const currentAIChatThread = useAtomStateValue(currentAIChatThreadStateV2);
|
||||
|
||||
const [agentChatUploadedFiles, setAgentChatUploadedFiles] = useRecoilStateV2(
|
||||
const [agentChatUploadedFiles, setAgentChatUploadedFiles] = useAtomState(
|
||||
agentChatUploadedFilesStateV2,
|
||||
);
|
||||
|
||||
const [agentChatInput, setAgentChatInput] = useRecoilStateV2(
|
||||
const [agentChatInput, setAgentChatInput] = useAtomState(
|
||||
agentChatInputStateV2,
|
||||
);
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ import { currentAIChatThreadStateV2 } from '@/ai/states/currentAIChatThreadState
|
||||
import { currentAIChatThreadTitleState } from '@/ai/states/currentAIChatThreadTitleState';
|
||||
import { isCreatingChatThreadStateV2 } from '@/ai/states/isCreatingChatThreadStateV2';
|
||||
import { mapDBMessagesToUIMessages } from '@/ai/utils/mapDBMessagesToUIMessages';
|
||||
import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2';
|
||||
import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2';
|
||||
import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';
|
||||
import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';
|
||||
import { type SetterOrUpdater } from 'recoil';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import {
|
||||
@@ -41,14 +41,14 @@ const setUsageFromThread = (
|
||||
};
|
||||
|
||||
export const useAgentChatData = () => {
|
||||
const [currentAIChatThread, setCurrentAIChatThread] = useRecoilStateV2(
|
||||
const [currentAIChatThread, setCurrentAIChatThread] = useAtomState(
|
||||
currentAIChatThreadStateV2,
|
||||
);
|
||||
const setAgentChatUsage = useSetRecoilStateV2(agentChatUsageStateV2);
|
||||
const setCurrentAIChatThreadTitle = useSetRecoilStateV2(
|
||||
const setAgentChatUsage = useSetAtomState(agentChatUsageStateV2);
|
||||
const setCurrentAIChatThreadTitle = useSetAtomState(
|
||||
currentAIChatThreadTitleState,
|
||||
);
|
||||
const [isCreatingChatThread, setIsCreatingChatThread] = useRecoilStateV2(
|
||||
const [isCreatingChatThread, setIsCreatingChatThread] = useAtomState(
|
||||
isCreatingChatThreadStateV2,
|
||||
);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { AI_CHAT_SCROLL_WRAPPER_ID } from '@/ai/constants/AiChatScrollWrapperId';
|
||||
import { useScrollWrapperHTMLElement } from '@/ui/utilities/scroll/hooks/useScrollWrapperHTMLElement';
|
||||
import { scrollWrapperScrollBottomComponentState } from '@/ui/utilities/scroll/states/scrollWrapperScrollBottomComponentState';
|
||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2';
|
||||
import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
const SCROLL_BOTTOM_THRESHOLD_PX = 10;
|
||||
@@ -11,7 +11,7 @@ export const useAgentChatScrollToBottom = () => {
|
||||
AI_CHAT_SCROLL_WRAPPER_ID,
|
||||
);
|
||||
|
||||
const scrollBottom = useRecoilComponentValueV2(
|
||||
const scrollBottom = useAtomComponentStateValue(
|
||||
scrollWrapperScrollBottomComponentState,
|
||||
AI_CHAT_SCROLL_WRAPPER_ID,
|
||||
);
|
||||
|
||||
@@ -4,13 +4,13 @@ import { DEFAULT_FAST_MODEL } from '@/ai/constants/DefaultFastModel';
|
||||
import { DEFAULT_SMART_MODEL } from '@/ai/constants/DefaultSmartModel';
|
||||
import { useWorkspaceAiModelAvailability } from '@/ai/hooks/useWorkspaceAiModelAvailability';
|
||||
import { aiModelsState } from '@/client-config/states/aiModelsState';
|
||||
import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2';
|
||||
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
|
||||
import { getModelProviderLabel } from '~/pages/settings/ai/utils/getModelProviderLabel';
|
||||
|
||||
export const useAiModelOptions = (
|
||||
includeDeprecated = false,
|
||||
): SelectOption<string>[] => {
|
||||
const aiModels = useRecoilValueV2(aiModelsState);
|
||||
const aiModels = useAtomStateValue(aiModelsState);
|
||||
const { isModelEnabled } = useWorkspaceAiModelAvailability();
|
||||
|
||||
return aiModels
|
||||
@@ -34,7 +34,7 @@ export const useAiModelLabel = (
|
||||
modelId: string | undefined,
|
||||
includeProvider = true,
|
||||
): string => {
|
||||
const aiModels = useRecoilValueV2(aiModelsState);
|
||||
const aiModels = useAtomStateValue(aiModelsState);
|
||||
|
||||
if (!modelId) {
|
||||
return '';
|
||||
|
||||
@@ -2,16 +2,14 @@ import { agentChatUsageStateV2 } from '@/ai/states/agentChatUsageStateV2';
|
||||
import { currentAIChatThreadStateV2 } from '@/ai/states/currentAIChatThreadStateV2';
|
||||
import { currentAIChatThreadTitleState } from '@/ai/states/currentAIChatThreadTitleState';
|
||||
import { useOpenAskAIPageInCommandMenu } from '@/command-menu/hooks/useOpenAskAIPageInCommandMenu';
|
||||
import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2';
|
||||
import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2';
|
||||
import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';
|
||||
import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';
|
||||
import { useCreateChatThreadMutation } from '~/generated-metadata/graphql';
|
||||
|
||||
export const useCreateNewAIChatThread = () => {
|
||||
const [, setCurrentAIChatThread] = useRecoilStateV2(
|
||||
currentAIChatThreadStateV2,
|
||||
);
|
||||
const setAgentChatUsage = useSetRecoilStateV2(agentChatUsageStateV2);
|
||||
const setCurrentAIChatThreadTitle = useSetRecoilStateV2(
|
||||
const [, setCurrentAIChatThread] = useAtomState(currentAIChatThreadStateV2);
|
||||
const setAgentChatUsage = useSetAtomState(agentChatUsageStateV2);
|
||||
const setCurrentAIChatThreadTitle = useSetAtomState(
|
||||
currentAIChatThreadTitleState,
|
||||
);
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { DEFAULT_FAST_MODEL } from '@/ai/constants/DefaultFastModel';
|
||||
import { DEFAULT_SMART_MODEL } from '@/ai/constants/DefaultSmartModel';
|
||||
import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
|
||||
import { aiModelsState } from '@/client-config/states/aiModelsState';
|
||||
import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2';
|
||||
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
|
||||
import { type ClientAiModelConfig } from '~/generated-metadata/graphql';
|
||||
|
||||
const VIRTUAL_MODEL_IDS: Set<string> = new Set([
|
||||
@@ -13,8 +13,8 @@ const VIRTUAL_MODEL_IDS: Set<string> = new Set([
|
||||
const isVirtualModel = (modelId: string) => VIRTUAL_MODEL_IDS.has(modelId);
|
||||
|
||||
export const useWorkspaceAiModelAvailability = () => {
|
||||
const aiModels = useRecoilValueV2(aiModelsState);
|
||||
const currentWorkspace = useRecoilValueV2(currentWorkspaceState);
|
||||
const aiModels = useAtomStateValue(aiModelsState);
|
||||
const currentWorkspace = useAtomStateValue(currentWorkspaceState);
|
||||
|
||||
const useRecommendedModels = currentWorkspace?.useRecommendedModels ?? true;
|
||||
const autoEnableNewAiModels = currentWorkspace?.autoEnableNewAiModels ?? true;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2';
|
||||
import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState';
|
||||
|
||||
export const agentChatInputStateV2 = createStateV2<string>({
|
||||
export const agentChatInputStateV2 = createAtomState<string>({
|
||||
key: 'agentChatInputStateV2',
|
||||
defaultValue: '',
|
||||
});
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { createComponentInstanceContext } from '@/ui/utilities/state/component-state/utils/createComponentInstanceContext';
|
||||
import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2';
|
||||
import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState';
|
||||
import { type AgentMessage } from '~/generated-metadata/graphql';
|
||||
|
||||
export const AgentChatMessagesComponentInstanceContext =
|
||||
createComponentInstanceContext();
|
||||
|
||||
export const agentChatMessagesComponentState = createComponentStateV2<
|
||||
export const agentChatMessagesComponentState = createAtomComponentState<
|
||||
AgentMessage[]
|
||||
>({
|
||||
key: 'agentChatMessagesComponentState',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2';
|
||||
import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState';
|
||||
|
||||
export const agentChatSelectedFilesStateV2 = createStateV2<File[]>({
|
||||
export const agentChatSelectedFilesStateV2 = createAtomState<File[]>({
|
||||
key: 'ai/agentChatSelectedFilesStateV2',
|
||||
defaultValue: [],
|
||||
});
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { type FileUIPart } from 'ai';
|
||||
|
||||
import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2';
|
||||
import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState';
|
||||
|
||||
export const agentChatUploadedFilesStateV2 = createStateV2<FileUIPart[]>({
|
||||
export const agentChatUploadedFilesStateV2 = createAtomState<FileUIPart[]>({
|
||||
key: 'ai/agentChatUploadedFilesStateV2',
|
||||
defaultValue: [],
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2';
|
||||
import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState';
|
||||
|
||||
export type AgentChatLastMessageUsage = {
|
||||
inputTokens: number;
|
||||
@@ -18,7 +18,8 @@ export type AgentChatUsageState = {
|
||||
outputCredits: number;
|
||||
};
|
||||
|
||||
export const agentChatUsageStateV2 = createStateV2<AgentChatUsageState | null>({
|
||||
key: 'agentChatUsageStateV2',
|
||||
defaultValue: null,
|
||||
});
|
||||
export const agentChatUsageStateV2 =
|
||||
createAtomState<AgentChatUsageState | null>({
|
||||
key: 'agentChatUsageStateV2',
|
||||
defaultValue: null,
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2';
|
||||
import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState';
|
||||
|
||||
export const currentAIChatThreadStateV2 = createStateV2<string | null>({
|
||||
export const currentAIChatThreadStateV2 = createAtomState<string | null>({
|
||||
key: 'ai/currentAIChatThreadStateV2',
|
||||
defaultValue: null,
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2';
|
||||
import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState';
|
||||
|
||||
export const currentAIChatThreadTitleState = createStateV2<string | null>({
|
||||
export const currentAIChatThreadTitleState = createAtomState<string | null>({
|
||||
key: 'ai/currentAIChatThreadTitleState',
|
||||
defaultValue: null,
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2';
|
||||
import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState';
|
||||
|
||||
export const isCreatingChatThreadStateV2 = createStateV2<boolean>({
|
||||
export const isCreatingChatThreadStateV2 = createAtomState<boolean>({
|
||||
key: 'ai/isCreatingChatThreadStateV2',
|
||||
defaultValue: false,
|
||||
});
|
||||
|
||||
@@ -11,9 +11,9 @@ import { previousUrlState } from '@/auth/states/previousUrlState';
|
||||
import { tokenPairState } from '@/auth/states/tokenPairState';
|
||||
import { appVersionState } from '@/client-config/states/appVersionState';
|
||||
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
|
||||
import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2';
|
||||
import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2';
|
||||
import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2';
|
||||
import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';
|
||||
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
|
||||
import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';
|
||||
import { AppPath } from 'twenty-shared/types';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { REACT_APP_SERVER_BASE_URL } from '~/config';
|
||||
@@ -25,20 +25,18 @@ export const useApolloFactory = (options: Partial<Options<any>> = {}) => {
|
||||
const apolloRef = useRef<ApolloFactory<NormalizedCacheObject> | null>(null);
|
||||
|
||||
const navigate = useNavigate();
|
||||
const setTokenPair = useSetRecoilStateV2(tokenPairState);
|
||||
const [currentWorkspace, setCurrentWorkspace] = useRecoilStateV2(
|
||||
const setTokenPair = useSetAtomState(tokenPairState);
|
||||
const [currentWorkspace, setCurrentWorkspace] = useAtomState(
|
||||
currentWorkspaceState,
|
||||
);
|
||||
const appVersion = useRecoilValueV2(appVersionState);
|
||||
const [currentWorkspaceMember, setCurrentWorkspaceMember] = useRecoilStateV2(
|
||||
const appVersion = useAtomStateValue(appVersionState);
|
||||
const [currentWorkspaceMember, setCurrentWorkspaceMember] = useAtomState(
|
||||
currentWorkspaceMemberState,
|
||||
);
|
||||
const setCurrentUser = useSetRecoilStateV2(currentUserState);
|
||||
const setCurrentUserWorkspace = useSetRecoilStateV2(
|
||||
currentUserWorkspaceState,
|
||||
);
|
||||
const setCurrentUser = useSetAtomState(currentUserState);
|
||||
const setCurrentUserWorkspace = useSetAtomState(currentUserWorkspaceState);
|
||||
|
||||
const setPreviousUrl = useSetRecoilStateV2(previousUrlState);
|
||||
const setPreviousUrl = useSetAtomState(previousUrlState);
|
||||
const location = useLocation();
|
||||
|
||||
const { enqueueErrorSnackBar } = useSnackBar();
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { useCreateAppRouter } from '@/app/hooks/useCreateAppRouter';
|
||||
import { currentUserState } from '@/auth/states/currentUserState';
|
||||
import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2';
|
||||
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
|
||||
import { RouterProvider } from 'react-router-dom';
|
||||
|
||||
export const AppRouter = () => {
|
||||
// We want to disable logic function settings but keep the code for now
|
||||
const isFunctionSettingsEnabled = false;
|
||||
|
||||
const currentUser = useRecoilValueV2(currentUserState);
|
||||
const currentUser = useAtomStateValue(currentUserState);
|
||||
|
||||
const isAdminPageEnabled =
|
||||
(currentUser?.canImpersonate || currentUser?.canAccessFullAdminPanel) ??
|
||||
|
||||
@@ -6,7 +6,7 @@ import { useExecuteTasksOnAnyLocationChange } from '@/app/hooks/useExecuteTasksO
|
||||
import { isAppEffectRedirectEnabledState } from '@/app/states/isAppEffectRedirectEnabledState';
|
||||
import { useRequestFreshCaptchaToken } from '@/captcha/hooks/useRequestFreshCaptchaToken';
|
||||
import { isCaptchaScriptLoadedState } from '@/captcha/states/isCaptchaScriptLoadedState';
|
||||
import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2';
|
||||
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
import {
|
||||
matchPath,
|
||||
@@ -34,7 +34,7 @@ import { getRecordIndexIdFromObjectNamePluralAndViewId } from '@/object-record/u
|
||||
import { PageFocusId } from '@/types/PageFocusId';
|
||||
import { useResetFocusStackToFocusItem } from '@/ui/utilities/focus/hooks/useResetFocusStackToFocusItem';
|
||||
import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType';
|
||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2';
|
||||
import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';
|
||||
import { AppBasePath, AppPath, CommandMenuPages } from 'twenty-shared/types';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { AnalyticsType } from '~/generated-metadata/graphql';
|
||||
@@ -66,12 +66,12 @@ export const PageChangeEffect = () => {
|
||||
const objectNamePlural =
|
||||
useParams().objectNamePlural ?? CoreObjectNamePlural.Person;
|
||||
|
||||
const contextStoreCurrentViewId = useRecoilComponentValueV2(
|
||||
const contextStoreCurrentViewId = useAtomComponentStateValue(
|
||||
contextStoreCurrentViewIdComponentState,
|
||||
MAIN_CONTEXT_STORE_INSTANCE_ID,
|
||||
);
|
||||
|
||||
const contextStoreCurrentViewType = useRecoilComponentValueV2(
|
||||
const contextStoreCurrentViewType = useAtomComponentStateValue(
|
||||
contextStoreCurrentViewTypeComponentState,
|
||||
MAIN_CONTEXT_STORE_INSTANCE_ID,
|
||||
);
|
||||
@@ -93,7 +93,7 @@ export const PageChangeEffect = () => {
|
||||
const { executeTasksOnAnyLocationChange } =
|
||||
useExecuteTasksOnAnyLocationChange();
|
||||
|
||||
const isAppEffectRedirectEnabled = useRecoilValueV2(
|
||||
const isAppEffectRedirectEnabled = useAtomStateValue(
|
||||
isAppEffectRedirectEnabledState,
|
||||
);
|
||||
|
||||
@@ -360,7 +360,7 @@ export const PageChangeEffect = () => {
|
||||
}, [eventTracker, location.pathname]);
|
||||
|
||||
const { requestFreshCaptchaToken } = useRequestFreshCaptchaToken();
|
||||
const isCaptchaScriptLoaded = useRecoilValueV2(isCaptchaScriptLoadedState);
|
||||
const isCaptchaScriptLoaded = useAtomStateValue(isCaptchaScriptLoadedState);
|
||||
|
||||
useEffect(() => {
|
||||
if (isCaptchaScriptLoaded && isCaptchaRequiredForPath(location.pathname)) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2';
|
||||
export const isAppEffectRedirectEnabledState = createStateV2<boolean>({
|
||||
import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState';
|
||||
export const isAppEffectRedirectEnabledState = createAtomState<boolean>({
|
||||
key: 'isAppEffectRedirectEnabledState',
|
||||
defaultValue: true,
|
||||
});
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2';
|
||||
import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState';
|
||||
|
||||
export const verifyEmailRedirectPathState = createStateV2<string | undefined>({
|
||||
key: 'verifyEmailRedirectPathState',
|
||||
defaultValue: undefined,
|
||||
});
|
||||
export const verifyEmailRedirectPathState = createAtomState<string | undefined>(
|
||||
{
|
||||
key: 'verifyEmailRedirectPathState',
|
||||
defaultValue: undefined,
|
||||
},
|
||||
);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user