twentyhq / twenty

Building a modern alternative to Salesforce, powered by the community.
https://twenty.com
GNU Affero General Public License v3.0
15.78k stars 1.73k forks source link

Multi Select cannot filter #5358

Open suwubee opened 4 months ago

suwubee commented 4 months ago

I create MultiSelect, but cannot filter it. image

greptile-apps[bot] commented 4 months ago

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

rob-luke commented 3 months ago

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

FerdiHr commented 3 months ago

Same here, should be a nice one for a first contribution! It's one of the main purpose of multi-select

gitstart-app[bot] commented 3 months ago

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

FelixMalfait commented 3 months ago

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)

charlesBochet commented 3 months ago

@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

FelixMalfait commented 3 months ago

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

FelixMalfait commented 3 months ago

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

martmull commented 2 months ago

@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

rob-luke commented 2 months ago

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

FelixMalfait commented 2 months ago

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

john-ramsey commented 2 months ago

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.

FelixMalfait commented 2 months ago

@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)

rob-luke commented 2 months ago

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

charlesBochet commented 1 month ago

This will be possible as we move out of pg_graphql