mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-03 08:49:51 +02:00
fix: preload with encoded page links
This commit is contained in:
parent
eac3239757
commit
021158a02d
1 changed files with 3 additions and 1 deletions
|
@ -17,7 +17,9 @@ import {matchRoutes} from 'react-router-config';
|
|||
* @returns Promise object represents whether pathname has been preloaded
|
||||
*/
|
||||
export default function preload(pathname: string): Promise<void[]> {
|
||||
const matches = matchRoutes(routes, pathname);
|
||||
const matches = [pathname, decodeURI(pathname)]
|
||||
.map(p => matchRoutes(routes, p))
|
||||
.flat();
|
||||
|
||||
return Promise.all(matches.map((match) => match.route.component.preload?.()));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue