fix(core): preload should support encoded page links#7977
Conversation
|
Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
✅ [V2]
To edit notification comments on pull requests, go to your Netlify site settings. |
|
|
||
| import routes from '@generated/routes'; | ||
| import {matchRoutes} from 'react-router-config'; | ||
| import { uniq } from 'lodash'; |
There was a problem hiding this comment.
This is client code. Please hand-roll your implementation (should be fairly trivial)
There was a problem hiding this comment.
checked the component.preload implementation, uniq is not necessary. preload won't actually run twice.
61ebe60 to
021158a
Compare
⚡️ Lighthouse report for the deploy preview of this PR
|
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
1 similar comment
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Co-authored-by: Sébastien Lorber <slorber@users.noreply.github.com>
Co-authored-by: Sébastien Lorber <slorber@users.noreply.github.com> Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com>
Motivation
Similar to #4407, when containing encoded chars (like whitespace, cn) "preload" won't work, and thus the page will blink (first render as static html, then empty, then after js loaded async render page again), and break the behavior that jumping to doc content with url hash
#.Test Plan
Wish to provide unit test, but stuck during initializing dev env. The code is simple, and is tested in my own repo.
A playground to show the problem: https://codesandbox.io/s/frosty-curran-rsoubc?file=/docs/%E5%85%A5%E9%97%A8%E4%BB%8B%E7%BB%8D.md. Visit
/docs/入门介绍and debugclient/preload.jsfile.preloadfunc won't match the extract route.Test links
Deploy preview: https://deploy-preview-7977--docusaurus-2.netlify.app/
Related issues/PRs
#4407