121788c42f
## Summary Removes the `recoil` dependency entirely from `package.json` and `twenty-front/package.json`, completing the migration to Jotai as the sole state management library. Removes all Recoil infrastructure: `RecoilRoot` wrapper from `App.tsx` and test decorators, `RecoilDebugObserver`, Recoil-specific ESLint rules (`use-getLoadable-and-getValue-to-get-atoms`, `useRecoilCallback-has-dependency-array`), and legacy Recoil utility hooks/types (`useRecoilComponentState`, `useRecoilComponentValue`, `createComponentState`, `createFamilyState`, `getSnapshotValue`, `cookieStorageEffect`, `localStorageEffect`, etc.). Renames all `V2`-suffixed Jotai state files and types to their canonical names (e.g., `ComponentStateV2` -> `ComponentState`, `agentChatInputStateV2` -> `agentChatInputState`, `SelectorCallbacksV2` -> `SelectorCallbacks`), and removes the now-redundant V1 counterparts. Updates ~433 files across the codebase to use the renamed Jotai imports, remove Recoil imports, and clean up test wrappers (`RecoilRootDecorator` -> `JotaiRootDecorator`).
74 lines
2.6 KiB
TypeScript
74 lines
2.6 KiB
TypeScript
import { useRunWorkflowRecordActions } from '@/action-menu/actions/record-actions/run-workflow-actions/hooks/useRunWorkflowRecordActions';
|
|
import { useRunWorkflowRecordAgnosticActions } from '@/action-menu/actions/record-agnostic-actions/run-workflow-actions/hooks/useRunWorkflowRecordAgnosticActions';
|
|
import {
|
|
ActionMenuContext,
|
|
type ActionMenuContextType,
|
|
} from '@/action-menu/contexts/ActionMenuContext';
|
|
import { useRegisteredActions } from '@/action-menu/hooks/useRegisteredActions';
|
|
import { useShouldActionBeRegisteredParams } from '@/action-menu/hooks/useShouldActionBeRegisteredParams';
|
|
import { useCommandMenuItemFrontComponentActions } from '@/command-menu-item/hooks/useCommandMenuItemFrontComponentActions';
|
|
import { contextStoreTargetedRecordsRuleComponentState } from '@/context-store/states/contextStoreTargetedRecordsRuleComponentState';
|
|
import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';
|
|
import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';
|
|
|
|
export const ActionMenuContextProviderDefault = ({
|
|
objectMetadataItem,
|
|
isInRightDrawer,
|
|
displayType,
|
|
actionMenuType,
|
|
children,
|
|
}: {
|
|
objectMetadataItem: ObjectMetadataItem;
|
|
isInRightDrawer: ActionMenuContextType['isInRightDrawer'];
|
|
displayType: ActionMenuContextType['displayType'];
|
|
actionMenuType: ActionMenuContextType['actionMenuType'];
|
|
children: React.ReactNode;
|
|
}) => {
|
|
const params = useShouldActionBeRegisteredParams({
|
|
objectMetadataItem,
|
|
});
|
|
|
|
const shouldBeRegisteredParams = {
|
|
...params,
|
|
};
|
|
|
|
const actions = useRegisteredActions(shouldBeRegisteredParams);
|
|
|
|
const contextStoreTargetedRecordsRule = useAtomComponentStateValue(
|
|
contextStoreTargetedRecordsRuleComponentState,
|
|
);
|
|
|
|
const isRecordSelection =
|
|
contextStoreTargetedRecordsRule.mode === 'selection' &&
|
|
contextStoreTargetedRecordsRule.selectedRecordIds.length > 0;
|
|
|
|
const runWorkflowRecordActions = useRunWorkflowRecordActions({
|
|
objectMetadataItem,
|
|
skip: !isRecordSelection,
|
|
});
|
|
|
|
const runWorkflowRecordAgnosticActions =
|
|
useRunWorkflowRecordAgnosticActions();
|
|
|
|
const commandMenuItemFrontComponentActions =
|
|
useCommandMenuItemFrontComponentActions();
|
|
|
|
return (
|
|
<ActionMenuContext.Provider
|
|
value={{
|
|
isInRightDrawer,
|
|
displayType,
|
|
actionMenuType,
|
|
actions: [
|
|
...actions,
|
|
...runWorkflowRecordActions,
|
|
...runWorkflowRecordAgnosticActions,
|
|
...commandMenuItemFrontComponentActions,
|
|
],
|
|
}}
|
|
>
|
|
{children}
|
|
</ActionMenuContext.Provider>
|
|
);
|
|
};
|