Skip to content
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

Allow to search null field on search resources / improve parse query on null handling #2177

Merged
merged 7 commits into from
Feb 21, 2025

Conversation

richardhjtan
Copy link
Contributor

@richardhjtan richardhjtan commented Feb 20, 2025

We have a scenario to get CRM task cards with no assignee when user clicks 'Unassigned' filter

Two layer of issues found with @tintinthong

  • currently, when we passing null value on query, it parses as empty string - so search doc couldn't find any cards of field which has null value
  • at formatQuery card-api layer, we can't query by assignee: null as it gives error about compound field ( NOTE: found this is not valid after fix the first issue and did several tests locally )

Solution

  • able to parse and stringify search query url with null, by using qs feature handling of null values strictNullHandling

Examples

Search doc of CRM task card with no assignee
crm-task-card-with-no-assignee

Error when filtering assignee null before the fix
Screenshot 2025-02-21 at 12 07 20 AM
Screenshot 2025-02-21 at 12 07 14 AM

After fix
Screenshot 2025-02-21 at 1 21 04 AM

@richardhjtan richardhjtan changed the title Allow to search null field on card-api formatQuery, improve parse query on null handling Allow to search null field on search resources / improve parse query on null handling Feb 20, 2025
module: `${testModuleRealm}friend`,
name: 'Friend',
},
every: [{ eq: { firstName: 'Mango' } }, { eq: { friend: null } }],
Copy link
Contributor Author

@richardhjtan richardhjtan Feb 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what i test in the CRM app, both { eq: { assignee : null}} or { eq: { 'assignee.id' : null}} able to give the same expected result after the fix

Copy link

github-actions bot commented Feb 20, 2025

Host Test Results

    1 files  ±0      1 suites  ±0   23m 20s ⏱️ -7s
772 tests +1  770 ✔️ +1  2 💤 ±0  0 ±0 
777 runs  +1  775 ✔️ +1  2 💤 ±0  0 ±0 

Results for commit 79fa53e. ± Comparison against base commit 868be56.

♻️ This comment has been updated with latest results.

Copy link
Contributor

@tintinthong tintinthong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

( NOTE: found this is not valid after fix the first issue and did several tests locally )

Good find on this!

@richardhjtan richardhjtan merged commit 99298ff into main Feb 21, 2025
48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants