-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Fixes date filter chip bugs #12788
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
Fixes date filter chip bugs #12788
Conversation
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
Improves date filter functionality by refactoring filter chip label computation and operand handling.
- Adds new utility
packages/twenty-front/src/modules/views/utils/getRecordFilterLabelValue.ts
to centralize filter label logic - Refactors
useApplyObjectFilterDropdownOperand
to properly handle DATE and DATE_TIME filters with IsToday, IsInFuture, IsInPast operands - Extracts complex ternary logic from
EditableFilterChip
into dedicated utility for better maintainability - Fixes crash when selecting relative date filters by properly handling the IsRelative operand case
3 files reviewed, 3 comments
Edit PR Review Bot Settings | Greptile
...rc/modules/object-record/object-filter-dropdown/hooks/useApplyObjectFilterDropdownOperand.ts
Show resolved
Hide resolved
packages/twenty-front/src/modules/views/components/EditableFilterChip.tsx
Show resolved
Hide resolved
packages/twenty-front/src/modules/views/utils/getRecordFilterLabelValue.ts
Show resolved
Hide resolved
🚀 Preview Environment Ready! Your preview environment is available at: http://bore.pub:37512 This environment will automatically shut down when the PR is closed or after 5 hours. |
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.
LGTM, left a comment
This PR fixes a bug that occurs during filter operand changes.
As a date filter can contain values that have a different shape, mainly date ISO string and hard-coded relative dates, changing the operand without resetting the value to its default was causing a crash.
This PR also extracts the logic that computes the right part of a filter chip into a util instead of a difficult to understand ternary, thus solving small bugs in the value displayed also.
Fixes #12778