Skip to content

Commit

Permalink
fix: preload with encoded page links
Browse files Browse the repository at this point in the history
  • Loading branch information
adventure-yunfei committed Aug 19, 2022
1 parent eac3239 commit 021158a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/docusaurus/src/client/preload.ts
Expand Up @@ -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?.()));
}

0 comments on commit 021158a

Please sign in to comment.