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(theme-common): do not run useLocationChange when hot reloading #6696

Merged
merged 1 commit into from
Feb 17, 2022

Conversation

lex111
Copy link
Contributor

@lex111 lex111 commented Feb 16, 2022

Motivation

Just noticed that we have the problem described in the issue again > #4794

This is still caused by the SkipContent component, but actually because the useLocationChange hook was triggered when it was not expected (changed doc -> hot reload -> re-render, but in fact the current location has not changed).

Have you read the Contributing Guidelines on pull requests?

Yes

Test Plan

  1. Start dev server
  2. Go to any doc page and scroll it a bit
  3. Edit any doc
  4. The scroll position of the current doc page should same as before

Related PRs

@lex111 lex111 added the pr: bug fix This PR fixes a bug in a past release. label Feb 16, 2022
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Feb 16, 2022
@netlify
Copy link

netlify bot commented Feb 16, 2022

✔️ [V2]

🔨 Explore the source changes: 469fce0

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

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

@github-actions
Copy link

⚡️ Lighthouse report for the changes in this PR:

Category Score
🟠 Performance 69
🟢 Accessibility 100
🟢 Best practices 100
🟢 SEO 100
🟢 PWA 92

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

@github-actions
Copy link

Size Change: +3 B (0%)

Total Size: 781 kB

ℹ️ View Unchanged
Filename Size Change
website/.docusaurus/globalData.json 48 kB 0 B
website/build/assets/css/styles.********.css 106 kB 0 B
website/build/assets/js/main.********.js 590 kB +3 B (0%)
website/build/index.html 37.6 kB 0 B

compressed-size-action

@gerhard
Copy link

gerhard commented Feb 17, 2022

This was extremely annoying when iterating locally on docs. Thank you for this fix!

I applied it manually and look forward to upgrading to the Docusaurus beta that will include it 🙌🏻

cc @slumbering

Copy link
Collaborator

@Josh-Cena Josh-Cena left a comment

Choose a reason for hiding this comment

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

This has been annoying for me as well. Glad you found the fix!

@Josh-Cena Josh-Cena merged commit 089ef14 into main Feb 17, 2022
@Josh-Cena Josh-Cena deleted the lex111/useLocationChange-fix-hotreload branch February 17, 2022 00:41
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: bug fix This PR fixes a bug in a past release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants