Skip to content

Conversation

bidoubiwa
Copy link
Contributor

Pull Request

What does this PR do?

Fixes #709

placeholderSearch is suppose to not showcase any search result when the query is empty. It now correctly does what it is suppose to do. It is also improved as it will now avoid to do a search request to Meilisearch.

@bidoubiwa bidoubiwa added the bug Something isn't working label Mar 23, 2022
Copy link
Contributor

@alallema alallema left a comment

Choose a reason for hiding this comment

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

LGTM! 🌯

@bidoubiwa bidoubiwa changed the base branch from main to remove_meilisearch_client_from_public March 25, 2022 20:09
Base automatically changed from remove_meilisearch_client_from_public to main March 28, 2022 11:07
@bidoubiwa
Copy link
Contributor Author

bors merge

@meili-bors
Copy link
Contributor

meili-bors bot commented Mar 28, 2022

@meili-bors meili-bors bot merged commit 7b09ec8 into main Mar 28, 2022
@meili-bors meili-bors bot deleted the fix_placeholdersearch branch March 28, 2022 11:11
Copy link
Member

@brunoocasali brunoocasali left a comment

Choose a reason for hiding this comment

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

@bidoubiwa i missed the timing here, but I really like to left some notes 🌮

expect(searchParams.limit).toBe(0)
})

test('Adapt SearchContext placeholderSearch set to false', () => {
Copy link
Member

Choose a reason for hiding this comment

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

This test has the same description as the first one :)

pagination,
defaultFacetDistribution,
placeholderSearch: !options.placeholderSearch, // true by default
placeholderSearch: options.placeholderSearch !== false, // true by default
Copy link
Member

Choose a reason for hiding this comment

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

This option is protected by type? Because if the user add 123, 0 in this option, the option will be true :)

await meilisearchClient.index('movies').waitForTask(documentsTask.uid)
})

test('Test placeholdersearch set to false', async () => {
Copy link
Member

Choose a reason for hiding this comment

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

What about describing what the test should be expecting?

Responds with no hits when placeholderSearch is falsy.

expect(hits.length).toBe(5)
})

test('Test placeholdersearch set to true', async () => {
Copy link
Member

Choose a reason for hiding this comment

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

There is a typo here (the setup use placeholderSearch: false)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

placeholderSearch option doesn't work in v0.6.2
3 participants