refacto dropdown v1>v2 in address input (#11549)
Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -2,11 +2,10 @@ import { clickOutsideListenerCallbacksComponentState } from '@/ui/utilities/poin
|
||||
import { clickOutsideListenerIsActivatedComponentState } from '@/ui/utilities/pointer-event/states/clickOutsideListenerIsActivatedComponentState';
|
||||
import { clickOutsideListenerIsMouseDownInsideComponentState } from '@/ui/utilities/pointer-event/states/clickOutsideListenerIsMouseDownInsideComponentState';
|
||||
import { clickOutsideListenerMouseDownHappenedComponentState } from '@/ui/utilities/pointer-event/states/clickOutsideListenerMouseDownHappenedComponentState';
|
||||
import { getScopeIdFromComponentId } from '@/ui/utilities/recoil-scope/utils/getScopeIdFromComponentId';
|
||||
import { extractComponentState } from '@/ui/utilities/state/component-state/utils/extractComponentState';
|
||||
|
||||
export const useClickOustideListenerStates = (componentId: string) => {
|
||||
const scopeId = getScopeIdFromComponentId(componentId);
|
||||
const scopeId = componentId;
|
||||
|
||||
return {
|
||||
scopeId,
|
||||
|
||||
@ -1,2 +0,0 @@
|
||||
export const getScopeIdFromComponentId = (componentId: string) =>
|
||||
`${componentId}`;
|
||||
@ -1,4 +0,0 @@
|
||||
import { getScopeIdFromComponentId } from '@/ui/utilities/recoil-scope/utils/getScopeIdFromComponentId';
|
||||
|
||||
export const getScopeIdOrUndefinedFromComponentId = (componentId?: string) =>
|
||||
componentId ? getScopeIdFromComponentId(componentId) : undefined;
|
||||
@ -1,5 +1,4 @@
|
||||
import { useAvailableScopeIdOrThrow } from '@/ui/utilities/recoil-scope/scopes-internal/hooks/useAvailableScopeId';
|
||||
import { getScopeIdOrUndefinedFromComponentId } from '@/ui/utilities/recoil-scope/utils/getScopeIdOrUndefinedFromComponentId';
|
||||
import { ComponentFamilyState } from '@/ui/utilities/state/component-state/types/ComponentFamilyState';
|
||||
import { SerializableParam } from 'recoil';
|
||||
|
||||
@ -22,7 +21,7 @@ export const useExtractedComponentFamilyStateV2 = <
|
||||
|
||||
const internalScopeId = useAvailableScopeIdOrThrow(
|
||||
componentContext,
|
||||
getScopeIdOrUndefinedFromComponentId(componentId),
|
||||
componentId,
|
||||
);
|
||||
|
||||
const extractedComponentFamilyState = (familyKey: FamilyKey) =>
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
import { SerializableParam, useRecoilValue } from 'recoil';
|
||||
|
||||
import { useAvailableScopeIdOrThrow } from '@/ui/utilities/recoil-scope/scopes-internal/hooks/useAvailableScopeId';
|
||||
import { getScopeIdOrUndefinedFromComponentId } from '@/ui/utilities/recoil-scope/utils/getScopeIdOrUndefinedFromComponentId';
|
||||
import { ComponentFamilyState } from '@/ui/utilities/state/component-state/types/ComponentFamilyState';
|
||||
|
||||
export const useRecoilComponentFamilyValue = <
|
||||
@ -24,7 +23,7 @@ export const useRecoilComponentFamilyValue = <
|
||||
|
||||
const internalComponentId = useAvailableScopeIdOrThrow(
|
||||
componentContext,
|
||||
getScopeIdOrUndefinedFromComponentId(componentId),
|
||||
componentId,
|
||||
);
|
||||
|
||||
return useRecoilValue(
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import { useAvailableScopeIdOrThrow } from '@/ui/utilities/recoil-scope/scopes-internal/hooks/useAvailableScopeId';
|
||||
import { getScopeIdOrUndefinedFromComponentId } from '@/ui/utilities/recoil-scope/utils/getScopeIdOrUndefinedFromComponentId';
|
||||
import { RecoilComponentState } from '@/ui/utilities/state/component-state/types/RecoilComponentState';
|
||||
import { useRecoilState } from 'recoil';
|
||||
|
||||
@ -19,7 +18,7 @@ export const useRecoilComponentState = <StateType>(
|
||||
|
||||
const internalComponentId = useAvailableScopeIdOrThrow(
|
||||
componentContext,
|
||||
getScopeIdOrUndefinedFromComponentId(componentId),
|
||||
componentId,
|
||||
);
|
||||
|
||||
return useRecoilState(
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
import { useRecoilValue } from 'recoil';
|
||||
|
||||
import { useAvailableScopeIdOrThrow } from '@/ui/utilities/recoil-scope/scopes-internal/hooks/useAvailableScopeId';
|
||||
import { getScopeIdOrUndefinedFromComponentId } from '@/ui/utilities/recoil-scope/utils/getScopeIdOrUndefinedFromComponentId';
|
||||
import { RecoilComponentState } from '@/ui/utilities/state/component-state/types/RecoilComponentState';
|
||||
|
||||
export const useRecoilComponentValue = <StateType>(
|
||||
@ -20,7 +19,7 @@ export const useRecoilComponentValue = <StateType>(
|
||||
|
||||
const internalComponentId = useAvailableScopeIdOrThrow(
|
||||
componentContext,
|
||||
getScopeIdOrUndefinedFromComponentId(componentId),
|
||||
componentId,
|
||||
);
|
||||
|
||||
return useRecoilValue(
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
import { useSetRecoilState } from 'recoil';
|
||||
|
||||
import { useAvailableScopeIdOrThrow } from '@/ui/utilities/recoil-scope/scopes-internal/hooks/useAvailableScopeId';
|
||||
import { getScopeIdOrUndefinedFromComponentId } from '@/ui/utilities/recoil-scope/utils/getScopeIdOrUndefinedFromComponentId';
|
||||
import { RecoilComponentState } from '@/ui/utilities/state/component-state/types/RecoilComponentState';
|
||||
|
||||
export const useSetRecoilComponentState = <StateType>(
|
||||
@ -20,7 +19,7 @@ export const useSetRecoilComponentState = <StateType>(
|
||||
|
||||
const internalComponentId = useAvailableScopeIdOrThrow(
|
||||
componentContext,
|
||||
getScopeIdOrUndefinedFromComponentId(componentId),
|
||||
componentId,
|
||||
);
|
||||
|
||||
return useSetRecoilState(
|
||||
|
||||
Reference in New Issue
Block a user