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: stable callbacks in useSearchQuery + refactor #5751

Merged
merged 1 commit into from
Oct 20, 2021

Conversation

slorber
Copy link
Collaborator

@slorber slorber commented Oct 20, 2021

Breaking change: the returned value of useSearchQuery has been updated

Motivation

This PR introduced a SearchPage regression: #5714

https://docusaurus.io/search

Unmemoized callbacks in useSearchQuery lead to infinite render loops.

This PR memoize the callbacks to fix the bug + refactor a little bit useSearchQuery + SearchPage to avoid some useless duplicated search query state (more refactorings should be done on the search page)

Have you read the Contributing Guidelines on pull requests?

yes

Test Plan

preview

@slorber slorber added pr: breaking change Existing sites may not build successfully in the new version. Description contains more details. pr: bug fix This PR fixes a bug in a past release. labels Oct 20, 2021
@slorber slorber requested a review from lex111 as a code owner October 20, 2021 15:09
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Oct 20, 2021
@netlify
Copy link

netlify bot commented Oct 20, 2021

✔️ [V2]

🔨 Explore the source changes: 6671ff3

🔍 Inspect the deploy log: https://app.netlify.com/sites/docusaurus-2/deploys/6170311fd4a1f50008250885

😎 Browse the preview: https://deploy-preview-5751--docusaurus-2.netlify.app

@github-actions
Copy link

⚡️ Lighthouse report for the changes in this PR:

Category Score
🟢 Performance 91
🟢 Accessibility 98
🟢 Best practices 100
🟢 SEO 100
🟢 PWA 95

Lighthouse ran on https://deploy-preview-5751--docusaurus-2.netlify.app/

@github-actions
Copy link

Size Change: +6 B (0%)

Total Size: 843 kB

ℹ️ View Unchanged
Filename Size Change
website/.docusaurus/globalData.json 38.1 kB 0 B
website/build/assets/css/styles.********.css 93.8 kB 0 B
website/build/assets/js/main.********.js 425 kB 0 B
website/build/blog/2017/12/14/introducing-docusaurus/index.html 67.7 kB 0 B
website/build/blog/index.html 38.5 kB 0 B
website/build/docs/index.html 45.7 kB +3 B (0%)
website/build/docs/installation/index.html 53.4 kB +3 B (0%)
website/build/index.html 31.2 kB 0 B
website/build/tests/docs/index.html 26.6 kB 0 B
website/build/tests/docs/standalone/index.html 23.3 kB 0 B

compressed-size-action

@slorber slorber changed the title fix: useSearchQuery fix: stable callbacks in useSearchQuery + refactr Oct 20, 2021
@slorber slorber changed the title fix: stable callbacks in useSearchQuery + refactr fix: stable callbacks in useSearchQuery + refactor Oct 20, 2021
@slorber slorber merged commit d799405 into main Oct 20, 2021
@slorber slorber deleted the slorber/refactor-search-useSearchQuery branch October 20, 2021 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: breaking change Existing sites may not build successfully in the new version. Description contains more details. pr: bug fix This PR fixes a bug in a past release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants