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

Fix - Filter stories by tag name #811

Merged
merged 1 commit into from
Nov 5, 2024

Conversation

fgyimah
Copy link
Contributor

@fgyimah fgyimah commented Nov 5, 2024

No description provided.

@@ -264,7 +264,7 @@ export function createClient(
[`locale`]: localeCode ? { $in: [localeCode] } : undefined,
[`status`]: { $in: [Story.Status.PUBLISHED] },
[`visibility`]: { $in: [Story.Visibility.PUBLIC] },
[`tag_names`]: tags?.length ? { $in: [tags] } : undefined,
[`tag.name`]: tags?.length ? { $any: [tags] } : undefined,
Copy link

@yuriyyakym yuriyyakym Nov 5, 2024

Choose a reason for hiding this comment

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

What's the difference between any and in in case of search predicate?
Please note that you're passing array in array ([tags]), I hope it's expected.

Choose a reason for hiding this comment

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

Would tags?.length ? { $in: tags } : undefined also work?

Copy link
Contributor Author

@fgyimah fgyimah Nov 5, 2024

Choose a reason for hiding this comment

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

This particular filter only supports $any, $all and $none filters, $in is not supported

Choose a reason for hiding this comment

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

But is there any difference between those predicates? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure there is

@fgyimah fgyimah merged commit 9007266 into main Nov 5, 2024
9 checks passed
@fgyimah fgyimah deleted the fix/fix-stories-filter-by-tag-names branch November 5, 2024 08:59
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