-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored object filter dropdown states (#9507)
Refactored object filter dropdown states while keeping the existing structure to avoid creating a big PR. The goal is to extract each sub hook returned by the useFilterDropdown hook and create a PR for each function and the associated refactor for the dependent zones in the code, so that we proceed by small increments.
- Loading branch information
1 parent
524962a
commit f44d99d
Showing
18 changed files
with
104 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 9 additions & 6 deletions
15
...object-record/object-filter-dropdown/hooks/useSetFilterDefinitionUsedInDropdownInScope.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 0 additions & 7 deletions
7
...filter-dropdown/scopes/scope-internal-context/ObjectFilterDropdownScopeInternalContext.ts
This file was deleted.
Oops, something went wrong.
6 changes: 4 additions & 2 deletions
6
...ect-record/object-filter-dropdown/states/advancedFilterViewFilterGroupIdComponentState.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
import { createComponentState } from '@/ui/utilities/state/component-state/utils/createComponentState'; | ||
import { ObjectFilterDropdownComponentInstanceContext } from '@/object-record/object-filter-dropdown/states/contexts/ObjectFilterDropdownComponentInstanceContext'; | ||
import { createComponentStateV2 } from '@/ui/utilities/state/component-state/utils/createComponentStateV2'; | ||
|
||
export const advancedFilterViewFilterGroupIdComponentState = | ||
createComponentState<string | undefined>({ | ||
createComponentStateV2<string | undefined>({ | ||
key: 'advancedFilterViewFilterGroupIdComponentState', | ||
defaultValue: undefined, | ||
componentInstanceContext: ObjectFilterDropdownComponentInstanceContext, | ||
}); |
6 changes: 4 additions & 2 deletions
6
...s/object-record/object-filter-dropdown/states/advancedFilterViewFilterIdComponentState.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
import { createComponentState } from '@/ui/utilities/state/component-state/utils/createComponentState'; | ||
import { ObjectFilterDropdownComponentInstanceContext } from '@/object-record/object-filter-dropdown/states/contexts/ObjectFilterDropdownComponentInstanceContext'; | ||
import { createComponentStateV2 } from '@/ui/utilities/state/component-state/utils/createComponentStateV2'; | ||
|
||
export const advancedFilterViewFilterIdComponentState = createComponentState< | ||
export const advancedFilterViewFilterIdComponentState = createComponentStateV2< | ||
string | undefined | ||
>({ | ||
key: 'advancedFilterViewFilterIdComponentState', | ||
defaultValue: undefined, | ||
componentInstanceContext: ObjectFilterDropdownComponentInstanceContext, | ||
}); |
6 changes: 4 additions & 2 deletions
6
...s/object-record/object-filter-dropdown/states/availableFilterDefinitionsComponentState.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
import { ObjectFilterDropdownComponentInstanceContext } from '@/object-record/object-filter-dropdown/states/contexts/ObjectFilterDropdownComponentInstanceContext'; | ||
import { FilterDefinition } from '@/object-record/object-filter-dropdown/types/FilterDefinition'; | ||
import { createComponentState } from '@/ui/utilities/state/component-state/utils/createComponentState'; | ||
import { createComponentStateV2 } from '@/ui/utilities/state/component-state/utils/createComponentStateV2'; | ||
|
||
export const availableFilterDefinitionsComponentState = createComponentState< | ||
export const availableFilterDefinitionsComponentState = createComponentStateV2< | ||
FilterDefinition[] | ||
>({ | ||
key: 'availableFilterDefinitionsComponentState', | ||
defaultValue: [], | ||
componentInstanceContext: ObjectFilterDropdownComponentInstanceContext, | ||
}); |
7 changes: 4 additions & 3 deletions
7
...ject-record/object-filter-dropdown/states/filterDefinitionUsedInDropdownComponentState.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import { createComponentState } from '@/ui/utilities/state/component-state/utils/createComponentState'; | ||
|
||
import { ObjectFilterDropdownComponentInstanceContext } from '@/object-record/object-filter-dropdown/states/contexts/ObjectFilterDropdownComponentInstanceContext'; | ||
import { createComponentStateV2 } from '@/ui/utilities/state/component-state/utils/createComponentStateV2'; | ||
import { FilterDefinition } from '../types/FilterDefinition'; | ||
|
||
export const filterDefinitionUsedInDropdownComponentState = | ||
createComponentState<FilterDefinition | null>({ | ||
createComponentStateV2<FilterDefinition | null>({ | ||
key: 'filterDefinitionUsedInDropdownComponentState', | ||
defaultValue: null, | ||
componentInstanceContext: ObjectFilterDropdownComponentInstanceContext, | ||
}); |
6 changes: 4 additions & 2 deletions
6
...bject-filter-dropdown/states/isObjectFilterDropdownOperandSelectUnfoldedComponentState.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
import { createComponentState } from '@/ui/utilities/state/component-state/utils/createComponentState'; | ||
import { ObjectFilterDropdownComponentInstanceContext } from '@/object-record/object-filter-dropdown/states/contexts/ObjectFilterDropdownComponentInstanceContext'; | ||
import { createComponentStateV2 } from '@/ui/utilities/state/component-state/utils/createComponentStateV2'; | ||
|
||
export const isObjectFilterDropdownOperandSelectUnfoldedComponentState = | ||
createComponentState<boolean>({ | ||
createComponentStateV2<boolean>({ | ||
key: 'isObjectFilterDropdownOperandSelectUnfoldedComponentState', | ||
defaultValue: false, | ||
componentInstanceContext: ObjectFilterDropdownComponentInstanceContext, | ||
}); |
8 changes: 5 additions & 3 deletions
8
...ject-record/object-filter-dropdown/states/isObjectFilterDropdownUnfoldedComponentState.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
import { createComponentState } from '@/ui/utilities/state/component-state/utils/createComponentState'; | ||
import { ObjectFilterDropdownComponentInstanceContext } from '@/object-record/object-filter-dropdown/states/contexts/ObjectFilterDropdownComponentInstanceContext'; | ||
import { createComponentStateV2 } from '@/ui/utilities/state/component-state/utils/createComponentStateV2'; | ||
|
||
export const isObjectFilterDropdownUnfoldedComponentState = | ||
createComponentState<boolean>({ | ||
key: 'isObjectFilterDropdownUnfoldedScopedState', | ||
createComponentStateV2<boolean>({ | ||
key: 'isObjectFilterDropdownUnfoldedComponentState', | ||
defaultValue: false, | ||
componentInstanceContext: ObjectFilterDropdownComponentInstanceContext, | ||
}); |
6 changes: 4 additions & 2 deletions
6
...ect-record/object-filter-dropdown/states/objectFilterDropdownSearchInputComponentState.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
import { createComponentState } from '@/ui/utilities/state/component-state/utils/createComponentState'; | ||
import { ObjectFilterDropdownComponentInstanceContext } from '@/object-record/object-filter-dropdown/states/contexts/ObjectFilterDropdownComponentInstanceContext'; | ||
import { createComponentStateV2 } from '@/ui/utilities/state/component-state/utils/createComponentStateV2'; | ||
|
||
export const objectFilterDropdownSearchInputComponentState = | ||
createComponentState<string>({ | ||
createComponentStateV2<string>({ | ||
key: 'objectFilterDropdownSearchInputComponentState', | ||
defaultValue: '', | ||
componentInstanceContext: ObjectFilterDropdownComponentInstanceContext, | ||
}); |
6 changes: 4 additions & 2 deletions
6
...d/object-filter-dropdown/states/objectFilterDropdownSelectedOptionValuesComponentState.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
import { createComponentState } from '@/ui/utilities/state/component-state/utils/createComponentState'; | ||
import { ObjectFilterDropdownComponentInstanceContext } from '@/object-record/object-filter-dropdown/states/contexts/ObjectFilterDropdownComponentInstanceContext'; | ||
import { createComponentStateV2 } from '@/ui/utilities/state/component-state/utils/createComponentStateV2'; | ||
|
||
export const objectFilterDropdownSelectedOptionValuesComponentState = | ||
createComponentState<string[]>({ | ||
createComponentStateV2<string[]>({ | ||
key: 'objectFilterDropdownSelectedOptionValuesComponentState', | ||
defaultValue: [], | ||
componentInstanceContext: ObjectFilterDropdownComponentInstanceContext, | ||
}); |
6 changes: 4 additions & 2 deletions
6
...cord/object-filter-dropdown/states/objectFilterDropdownSelectedRecordIdsComponentState.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
import { createComponentState } from '@/ui/utilities/state/component-state/utils/createComponentState'; | ||
import { ObjectFilterDropdownComponentInstanceContext } from '@/object-record/object-filter-dropdown/states/contexts/ObjectFilterDropdownComponentInstanceContext'; | ||
import { createComponentStateV2 } from '@/ui/utilities/state/component-state/utils/createComponentStateV2'; | ||
|
||
export const objectFilterDropdownSelectedRecordIdsComponentState = | ||
createComponentState<string[]>({ | ||
createComponentStateV2<string[]>({ | ||
key: 'objectFilterDropdownSelectedRecordIdsComponentState', | ||
defaultValue: [], | ||
componentInstanceContext: ObjectFilterDropdownComponentInstanceContext, | ||
}); |
7 changes: 4 additions & 3 deletions
7
...t/src/modules/object-record/object-filter-dropdown/states/onFilterSelectComponentState.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
import { createComponentState } from '@/ui/utilities/state/component-state/utils/createComponentState'; | ||
|
||
import { ObjectFilterDropdownComponentInstanceContext } from '@/object-record/object-filter-dropdown/states/contexts/ObjectFilterDropdownComponentInstanceContext'; | ||
import { createComponentStateV2 } from '@/ui/utilities/state/component-state/utils/createComponentStateV2'; | ||
import { Filter } from '../types/Filter'; | ||
|
||
export const onFilterSelectComponentState = createComponentState< | ||
export const onFilterSelectComponentState = createComponentStateV2< | ||
((filter: Filter | null) => void) | undefined | ||
>({ | ||
key: 'onFilterSelectComponentState', | ||
defaultValue: undefined, | ||
componentInstanceContext: ObjectFilterDropdownComponentInstanceContext, | ||
}); |
7 changes: 4 additions & 3 deletions
7
...t/src/modules/object-record/object-filter-dropdown/states/selectedFilterComponentState.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
import { createComponentState } from '@/ui/utilities/state/component-state/utils/createComponentState'; | ||
|
||
import { ObjectFilterDropdownComponentInstanceContext } from '@/object-record/object-filter-dropdown/states/contexts/ObjectFilterDropdownComponentInstanceContext'; | ||
import { createComponentStateV2 } from '@/ui/utilities/state/component-state/utils/createComponentStateV2'; | ||
import { Filter } from '../types/Filter'; | ||
|
||
export const selectedFilterComponentState = createComponentState< | ||
export const selectedFilterComponentState = createComponentStateV2< | ||
Filter | undefined | null | ||
>({ | ||
key: 'selectedFilterComponentState', | ||
defaultValue: undefined, | ||
componentInstanceContext: ObjectFilterDropdownComponentInstanceContext, | ||
}); |
6 changes: 4 additions & 2 deletions
6
...es/object-record/object-filter-dropdown/states/selectedOperandInDropdownComponentState.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
import { createComponentState } from '@/ui/utilities/state/component-state/utils/createComponentState'; | ||
import { ObjectFilterDropdownComponentInstanceContext } from '@/object-record/object-filter-dropdown/states/contexts/ObjectFilterDropdownComponentInstanceContext'; | ||
import { createComponentStateV2 } from '@/ui/utilities/state/component-state/utils/createComponentStateV2'; | ||
import { ViewFilterOperand } from '@/views/types/ViewFilterOperand'; | ||
|
||
export const selectedOperandInDropdownComponentState = | ||
createComponentState<ViewFilterOperand | null>({ | ||
createComponentStateV2<ViewFilterOperand | null>({ | ||
key: 'selectedOperandInDropdownComponentState', | ||
defaultValue: null, | ||
componentInstanceContext: ObjectFilterDropdownComponentInstanceContext, | ||
}); |