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: search request amount made on page arrival #486

Merged
merged 5 commits into from
Jan 31, 2024

Conversation

mdubus
Copy link
Member

@mdubus mdubus commented Jan 24, 2024

Pull Request

What does this PR do?

  • Creation of a MeilisearchClientContext for maintainability (instead of passing down 2 clients to the components)
  • Functions have been put in specific files (instead of inside the useEffect)
  • Functions needing to stay in the App file are now wrapped inside a useCallback
  • Some components have been put in specific files (instead of inside the App file)
  • Fix the amount of search requests made on page load (from 20 down to 4)
  • The Header now doesn't show up when Meilisearch isn't running (this caused re-rendering and search requests)
  • Fix tests (addition of waiting_time as a quick fix, as Cypress is now too fast and CI was failing). Tests would need a refacto anyway 🤷

PR checklist

Please check if your PR fulfills the following requirements:

  • Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
  • Have you read the contributing guidelines?
  • Have you made sure that the title is accurate and descriptive of the changes?

Thank you so much for contributing to Meilisearch!

@mdubus mdubus changed the title Fix search requests more than expected fix: search request amount made on page arrival Jan 24, 2024
@mdubus mdubus marked this pull request as draft January 24, 2024 09:25
@mdubus mdubus force-pushed the fix_search_requests_more_than_expected branch from f3b59d8 to d9f1e16 Compare January 24, 2024 09:32
@mdubus mdubus marked this pull request as ready for review January 24, 2024 09:37
@mdubus mdubus force-pushed the fix_search_requests_more_than_expected branch from f27181f to 2a0ce46 Compare January 24, 2024 14:58
src/App.js Outdated Show resolved Hide resolved
src/App.js Show resolved Hide resolved
src/components/Body.js Show resolved Hide resolved
Copy link
Member

@nicolasvienot nicolasvienot left a comment

Choose a reason for hiding this comment

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

Everything worked fine for me while testing - I built the package with yarn build and used a project from the cloud.

The only issue I can see is that on start or refresh, it first shows the page with "It seems like Meilisearch isn’t running, did you forget to start it? - (Don’t forget to set an API Key if you want one)", then "Sorry mate, no results matching your request ☹️", then the results.

I expect it to show directly the results with a loading state.

But this should not block this PR; it can be tackled in another PR, and we can decide whether to release it like this or not in Meilisearch 1.6.1.

I'm opening an issue in this repo.

EDIT: link of the issue

@atoulmet atoulmet self-requested a review January 31, 2024 10:12
@mdubus mdubus merged commit 93c6f01 into main Jan 31, 2024
4 checks passed
@mdubus mdubus deleted the fix_search_requests_more_than_expected branch January 31, 2024 13:38
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