Refactor useDropdown states to component state V2 (#12911)
This PR is a follow-up of the first refactor of dropdown hooks : https://github.com/twentyhq/twenty/pull/12875 In this PR we continue by focusing on the replacement of those two states that are still using the v1 of component states : - isDropdownOpenComponentState - dropdownPlacementComponentState When then remove those two old states and now only use the new component state v2. ## QA Component | Status | Comments -- | -- | -- RecordDetailRelationSectionDropdownToMany | Ok | RecordDetailRelationSectionDropdownToOne | Ok | WorkflowVariablesDropdown | Ok | DropdownInternalContainer | Ok | Tested on tables and boards fields
This commit is contained in:
+5
-5
@@ -1,8 +1,8 @@
|
||||
import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown';
|
||||
import { StyledDropdownButtonContainer } from '@/ui/layout/dropdown/components/StyledDropdownButtonContainer';
|
||||
import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown';
|
||||
import { isDropdownOpenComponentState } from '@/ui/layout/dropdown/states/isDropdownOpenComponentState';
|
||||
import { extractComponentState } from '@/ui/utilities/state/component-state/utils/extractComponentState';
|
||||
import { isDropdownOpenComponentStateV2 } from '@/ui/layout/dropdown/states/isDropdownOpenComponentStateV2';
|
||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
|
||||
import { WorkflowVariablesDropdownFieldItems } from '@/workflow/workflow-variables/components/WorkflowVariablesDropdownFieldItems';
|
||||
import { WorkflowVariablesDropdownObjectItems } from '@/workflow/workflow-variables/components/WorkflowVariablesDropdownObjectItems';
|
||||
import { WorkflowVariablesDropdownWorkflowStepItems } from '@/workflow/workflow-variables/components/WorkflowVariablesDropdownWorkflowStepItems';
|
||||
@@ -13,7 +13,6 @@ import { StepOutputSchema } from '@/workflow/workflow-variables/types/StepOutput
|
||||
import { useTheme } from '@emotion/react';
|
||||
import styled from '@emotion/styled';
|
||||
import { useState } from 'react';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { IconVariablePlus } from 'twenty-ui/display';
|
||||
|
||||
@@ -48,8 +47,9 @@ export const WorkflowVariablesDropdown = ({
|
||||
const theme = useTheme();
|
||||
|
||||
const dropdownId = `${SEARCH_VARIABLES_DROPDOWN_ID}-${inputId}`;
|
||||
const isDropdownOpen = useRecoilValue(
|
||||
extractComponentState(isDropdownOpenComponentState, dropdownId),
|
||||
const isDropdownOpen = useRecoilComponentValueV2(
|
||||
isDropdownOpenComponentStateV2,
|
||||
dropdownId,
|
||||
);
|
||||
const { closeDropdown } = useCloseDropdown();
|
||||
const availableVariablesInWorkflowStep = useAvailableVariablesInWorkflowStep({
|
||||
|
||||
Reference in New Issue
Block a user