Skip to content

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

Merged
merged 5 commits into from
Jun 24, 2025
Merged

Fixes date filter chip bugs #12788

merged 5 commits into from
Jun 24, 2025

Conversation

lucasbordeau
Copy link
Contributor

@lucasbordeau lucasbordeau commented Jun 23, 2025

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

Copy link
Contributor

@greptile-apps greptile-apps bot left a 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

Copy link
Contributor

github-actions bot commented Jun 23, 2025

🚀 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.

@bosiraphael bosiraphael self-requested a review June 24, 2025 08:32
Copy link
Contributor

@bosiraphael bosiraphael left a 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

@lucasbordeau lucasbordeau enabled auto-merge (squash) June 24, 2025 09:18
@lucasbordeau lucasbordeau merged commit c56ccf7 into main Jun 24, 2025
54 checks passed
@lucasbordeau lucasbordeau deleted the fix/relative-date-filter branch June 24, 2025 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Selecting relative date filter is crashing the page
2 participants