Skip to content

fix(theme-common): do not run useLocationChange when hot reloading - #6696

Merged
Josh-Cena merged 1 commit into
mainfrom
lex111/useLocationChange-fix-hotreload
Feb 17, 2022
Merged

Josh-Cena merged 1 commit into
mainfrom
lex111/useLocationChange-fix-hotreload

Conversation

@lex111

@lex111 lex111 commented Feb 16, 2022

Copy link
Copy Markdown
Contributor

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

netlify Bot commented Feb 16, 2022

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

⚡️ 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
Copy Markdown

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

gerhard commented Feb 17, 2022 •

Copy link
Copy Markdown

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

@Josh-Cena Josh-Cena left a comment

Copy link
Copy Markdown
Collaborator

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
mrizwanashiq pushed a commit to mrizwanashiq/docusaurus that referenced this pull request Jun 25, 2026
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