-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Fix IN filter with empty array #7202
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
This pull request addresses an issue with the IN filter handling empty arrays in the API and updates the frontend to optimize API calls accordingly.
- Modified
packages/twenty-server/src/engine/api/graphql/graphql-query-runner/graphql-query-parsers/graphql-query-filter/graphql-query-filter-field.parser.ts
to throw an error for empty arrays in IN filters - Updated
packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsMessageChannelsContainer.tsx
to skip API calls when the accounts array is empty - Improved error handling in the backend to prevent unexpected behavior with empty IN filters
- Optimized frontend performance by avoiding unnecessary API requests for empty data sets
- Removed unused import and switched to native Array.isArray() method in the backend parser
2 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings
return; | ||
if (operator === 'in') { | ||
if (!Array.isArray(value)) { | ||
return; |
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.
THROW!
More details in this PR #7202 We(I) forgot to fix on the calendar page.
Context
The api currently allows empty array in the IN filter but the expected behaviour is not very clear. Typeorm seems to return all records when it is empty which could lead to undesired result. Instead we decided to throw an error.
I've updated the FE accordingly to skip calls when array is empty.