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

sub_query Smart Search filter crashes if org has no smart searches yet. #1699

Merged
merged 1 commit into from
Dec 14, 2023

Conversation

ziggabyte
Copy link
Contributor

Description

This PR fixes a bug where the UI would crash when rendering the Smart search filter form for sub_query, by actually testing if there are queries to select from and if there are none, render a message instead.

Screenshots

bild

Changes

  • Switch out accidentally always truthy conditions with actual condition tests
  • Render a message when there are no queries to select from.

Related issues

Resolves #1690

Copy link
Member

@richardolsson richardolsson left a comment

Choose a reason for hiding this comment

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

Just looking at the code, I'm not sure if this is working as I would expect. Does the logic care about call assignments?

Comment on lines +131 to +133
queries.length == 0 ? (
<Msg id={messageIds.filters.subQuery.noSmartSearches} />
) : (
Copy link
Member

Choose a reason for hiding this comment

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

What happens when there are no standalone smart search queries (queries) but there are call assignments?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This filter already takes callassignments into consideration, the queries variable here is an array made up of standalone queries, call assignment target queries, and call assignment "done" queries:
bild

Copy link
Member

Choose a reason for hiding this comment

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

Ah, I went looking for it but clearly not thoroughly enough. Thanks for clarifying!

Copy link
Member

@richardolsson richardolsson left a comment

Choose a reason for hiding this comment

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

Thank you @ziggabyte for pointing out what I missed. I'm happy with this now that I understand it fully!

@ziggabyte ziggabyte merged commit 6bd68fe into main Dec 14, 2023
4 checks passed
@ziggabyte ziggabyte deleted the issue-1690/sub-query-filter-crashes branch December 14, 2023 07:50
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.

Bug in sub_query Smart Search filter UI when there are no standalone filters
2 participants