twenty icon indicating copy to clipboard operation
twenty copied to clipboard

Multi Select cannot filter

Open suwubee opened this issue 9 months ago • 18 comments

I create MultiSelect, but cannot filter it. image

suwubee avatar May 12 '24 09:05 suwubee

Disclaimer: This comment was automatically generated with AI. It can give some useful hints as to where to look for, but sometimes it can also give very inaccurate answers so takes this with a pinch of salt :). To address the issue of the MultiSelect component not filtering options, ensure the searchFilter state in MultiSelectFieldInput.tsx is correctly applied to filter optionsInDropDown. Currently, optionsInDropDown does not utilize searchFilter for filtering options. Implement filtering logic similar to: javascript optionsInDropDown.filter(option => option.label.toLowerCase().includes(searchFilter.toLowerCase())) Also, verify that useFilterDropdown and useMultiSelectField hooks properly manage state changes related to filtering. This might involve ensuring that the component re-renders upon searchFilter state changes and that the filtering logic is correctly applied within these hooks.

References

/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownOptionSelect.tsx /packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/MultiSelectFieldInput.tsx /packages/twenty-front/src/modules/object-record/object-filter-dropdown/hooks/useFilterDropdown.ts /packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useMultiSelectField.ts

Ask Greptile

greptile-apps[bot] avatar May 12 '24 09:05 greptile-apps[bot]

I confirm I have the same bug on v0.11.3 and v0.12.1

rob-luke avatar May 27 '24 11:05 rob-luke

Same here

FerdiHr avatar May 28 '24 11:05 FerdiHr

Here is the GitStart Ticket for this issue: https://clients.gitstart.com/twenty/5449/tickets/TWNTY-5358

gitstart-app[bot] avatar Jun 05 '24 06:06 gitstart-app[bot]

Thanks for the report!

@gitstart-twenty could you please take care of this? And do a quick audit of any other missing filters for various field type? (we don't want to be exhaustive as some don't make much business sense but we might have missed important ones like the one above ; see also https://github.com/twentyhq/twenty/issues/5216 which is ongoing)

FelixMalfait avatar Jun 05 '24 06:06 FelixMalfait

@FelixMalfait pg_graphql does not support filtering by Array at the moment. This ticket cannot be done until we migrate out of pg_graphql or they update their filtering feature

charlesBochet avatar Jun 12 '24 12:06 charlesBochet

@charlesBochet seems like this was just implemented! https://github.com/supabase/pg_graphql/pull/520

FelixMalfait avatar Jun 12 '24 19:06 FelixMalfait

Released yesterday: https://github.com/supabase/pg_graphql/releases/tag/v1.5.6

FelixMalfait avatar Jun 12 '24 19:06 FelixMalfait

@FelixMalfait @charlesBochet @suwubee, well, think we have to wait a little bit to have enum filter support -> https://github.com/supabase/pg_graphql/issues/530

martmull avatar Jun 18 '24 15:06 martmull

Excited to see that this issue moved to done in the product development project 🚀 . Is this issue now closed? I am very excited to use this 😄 @martmull @charlesBochet

rob-luke avatar Jul 03 '24 23:07 rob-luke

Unfortunately this is still stuck due to the issue linked above by @martmull - we cannot solve this as long as the above issue isn't solved

FelixMalfait avatar Jul 04 '24 08:07 FelixMalfait

Potentially tangental comment but worth calling out that pg_graphql isn't supported as an extention in GCP CloudSQL, Azure Database for PostgreSQL or AWS RDS.

While likely a large item to migrate away from pg_graphql this should be added to the list of reasons.

john-ramsey avatar Jul 05 '24 06:07 john-ramsey

@john-ramsey Yes the pg_graphql did an amazing job that allowed us to move faster initially, but long-term we'll probably have to replace because of the limitations (another one is the inability to filter by a nested object's property)

FelixMalfait avatar Jul 05 '24 08:07 FelixMalfait

In case its useful for anyone else. I have temporarily got around this by writing a script that copies the multi select fields as text in to a text field called "multiselecthack", and then I can filter based on that. But this quickly causes you to hit this issue: https://github.com/twentyhq/twenty/issues/5056

rob-luke avatar Jul 07 '24 10:07 rob-luke

This will be possible as we move out of pg_graphql

charlesBochet avatar Aug 14 '24 15:08 charlesBochet

I would also suggest not using postgres enums as they are very limiting (you can't remove options, reorder, etc). In general it is easier to use a check constraint or verify in software (and use plain strings in db).

Sytten avatar Sep 16 '24 16:09 Sytten

@Sytten we actually already support postgres enum editing (we have some code handling it and agree it was not a piece of cake!) as data integrity is quite important for Twenty

This ticket is unblocked now :)

charlesBochet avatar Oct 09 '24 15:10 charlesBochet