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

feat(content): Optional search parameter #733

Merged
merged 4 commits into from
Jan 26, 2021
Merged

Conversation

Billybobbonnet
Copy link
Contributor

@Billybobbonnet Billybobbonnet commented Jan 26, 2021

Types of changes

  • Bug fix (a non-breaking change which fixes an issue)
  • New feature (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

Passing an empty string as query value will avoid triggering a search to allow optional chaining such as this:

      this.total = (await this.$content('people')
          .search('')
          .only([])
          .fetch()).length

Docs have been updated in FR & EN. JA & RU update necessary.

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes (if not applicable, please state why)

@Billybobbonnet
Copy link
Contributor Author

I went for an explicit false parameter but maybe it would be more elegant and concise to skip the search if there is no parameter or an empty string. It can be fixed, let me know.

@Billybobbonnet Billybobbonnet changed the title Optional search parameter feat(content) : Optional search parameter Jan 26, 2021
@atinux
Copy link
Member

atinux commented Jan 26, 2021

What about an empty string @Billybobbonnet, doesn't it work with it?

@Billybobbonnet
Copy link
Contributor Author

What about an empty string @Billybobbonnet, doesn't it work with it?

In the current version, nope.
image

I updated my PR to fix this.

@Billybobbonnet Billybobbonnet changed the title feat(content) : Optional search parameter feat(content): Optional search parameter Jan 26, 2021
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.

2 participants