-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix bug and refactored advanced filter field selection dropdown #11103
Merged
charlesBochet
merged 4 commits into
main
from
refactor/advanced-filter-dropdown-field-selection
Mar 24, 2025
Merged
Fix bug and refactored advanced filter field selection dropdown #11103
charlesBochet
merged 4 commits into
main
from
refactor/advanced-filter-dropdown-field-selection
Mar 24, 2025
Conversation
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
… logic - Renamed useAdvancedFilterDropdown to useAdvancedFilterFieldSelectDropdown and removed its usage in generic object filter dropdown - Created AdvancedFilterFieldSelectMenu and AdvancedFilterSubFieldSelectMenu to handle field selection in advanced filter field select dropdown - Created useSelectFieldUsedInAdvancedFilterDropdown to handle field selection in advanced filter field select dropdown - Removed advancedFilterViewFilterGroupIdComponentState - Removed advancedFilterViewFilterIdComponentState
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
This PR refactors the advanced filter dropdown logic by isolating it from the generic filter dropdown, improving code organization and maintainability through dedicated components and hooks.
- Added
AdvancedFilterFieldSelectMenu
andAdvancedFilterSubFieldSelectMenu
components to handle specific advanced filter field selection logic - Introduced
ObjectFilterDropdownFilterSelectMenuItemV2
with explicitonClick
prop for better control flow and separation of concerns - Created
useSelectFieldUsedInAdvancedFilterDropdown
hook to verticalize advanced filter field selection logic - Removed shared states like
advancedFilterViewFilterIdComponentState
andadvancedFilterViewFilterGroupIdComponentState
in favor of explicit implementations - Renamed
useAdvancedFilterDropdown
touseAdvancedFilterFieldSelectDropdown
for clarity and specificity
15 file(s) reviewed, 10 comment(s)
Edit PR Review Bot Settings | Greptile
...front/src/modules/object-record/advanced-filter/components/AdvancedFilterFieldSelectMenu.tsx
Outdated
Show resolved
Hide resolved
...front/src/modules/object-record/advanced-filter/components/AdvancedFilterFieldSelectMenu.tsx
Show resolved
Hide resolved
...nt/src/modules/object-record/advanced-filter/components/AdvancedFilterSubFieldSelectMenu.tsx
Show resolved
Hide resolved
...modules/object-record/advanced-filter/components/AdvancedFilterFieldSelectDrodownContent.tsx
Outdated
Show resolved
Hide resolved
...modules/object-record/advanced-filter/components/AdvancedFilterFieldSelectDrodownContent.tsx
Outdated
Show resolved
Hide resolved
.../modules/object-record/advanced-filter/components/AdvancedFilterFieldSelectDrodownButton.tsx
Outdated
Show resolved
Hide resolved
...rc/modules/object-record/advanced-filter/hooks/useSelectFieldUsedInAdvancedFilterDropdown.ts
Show resolved
Hide resolved
...modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownFilterSelect.tsx
Outdated
Show resolved
Hide resolved
...ject-record/object-filter-dropdown/components/ObjectFilterDropdownFilterSelectMenuItemV2.tsx
Show resolved
Hide resolved
...ject-record/object-filter-dropdown/components/ObjectFilterDropdownFilterSelectMenuItemV2.tsx
Show resolved
Hide resolved
- Fixed typo Drodown to Dropdown
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is a first step towards isolating each filter dropdown use case, here we isolate advanced filter field selection dropdown from view bar filter field selection dropdown.
Isolation of advanced filter field selection logic
We reimplement the previously generic logic into AdvancedFilterFieldSelectMenu and AdvancedFilterSubFieldSelectMenu components.
For now it contains duplicated code but, the end goal is to factorize what's common to all object filter dropdowns in small hooks where possible, at the end of the code path isolation first step, which will be done for applyFilter and selectFilter logic that will be able to be deleted after code path isolation.
A new component ObjectFilterDropdownFilterSelectMenuItemV2 has been created to expose an onClick method instead of computing logic that tries to guess where it is located, which allows to verticalize what happens when we select a field in each specific use case, one layer above.
Created the hook useSelectFieldUsedInAdvancedFilterDropdown which contains the logic for field selection for advanced filter field select dropdown specific use case, the first example of a good verticalized and unique place to handle field selection in the context of advanced filter.
The naming useAdvancedFilterDropdown was lying and is now useAdvancedFilterFieldSelectDropdown which is now self-explanatory.
useAdvancedFilterFieldSelectDropdown has been removed from the main object filter dropdown, thus isolating advanced filters field select dropdown from the generic object filter field select dropdown.
Miscellaneous
Removed states that were used in the generic filter dropdown to guess whether it was in advanced filter context or not.