Open Bonapara opened 3 weeks ago
To resolve the issue where the filter 'Is Empty' / 'Is not Empty' gets reinitialized when clicking outside, follow these steps:
Update EditableFilterDropdownButton.tsx
:
handleDropdownClickOutside
function to prevent reinitialization of the filter when clicking outside.
const handleDropdownClickOutside = useCallback(() => {
// Remove the condition that checks for value
// const { id: fieldId, value } = viewFilter;
// if (!value) {
// removeCombinedViewFilter(fieldId);
// }
}, [viewFilter, removeCombinedViewFilter]);
Ensure Proper State Management in useFilterDropdown.ts
:
resetFilter
and emptyFilterButKeepDefinition
functions to ensure they are not being called unintentionally.Check ViewBarFilterEffect.tsx
:
These changes should address the issue of the filter getting reinitialized when clicking outside and make it possible to save the view.
/packages/twenty-front/src/modules/object-record/object-filter-dropdown/hooks/useFilterDropdown.ts /packages/twenty-front/src/modules/views/components/EditableFilterDropdownButton.tsx /packages/twenty-front/src/modules/views/hooks/useCombinedViewFilters.ts /packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownFilterSelect.tsx /packages/twenty-front/src/modules/views/components/ViewBarFilterEffect.tsx
Description
When clicking outside, the filter gets reinitialized. It's also impossible to save the view.
https://github.com/twentyhq/twenty/assets/19412894/f4d98d77-10fc-4d1f-b752-045b44c05ea5
How to reproduce
Go to the
People
object and try to filter byEmployees
== Not nullHow it should behave
The blue chip should remain in the filter bar when the menu is closed.