Compare commits

...

3 Commits

Author SHA1 Message Date
sebastienlorber 98957bbeaf prettier 2022-08-25 13:28:57 +02:00
adventure-yunfei 31591a3877
Update packages/docusaurus/src/client/preload.ts
Co-authored-by: Sébastien Lorber <slorber@users.noreply.github.com>
2022-08-25 16:41:34 +08:00
adventure-yunfei 021158a02d fix: preload with encoded page links 2022-08-19 12:28:28 +08:00
1 changed files with 3 additions and 1 deletions

View File

@ -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 = Array.from(new Set([pathname, decodeURI(pathname)]))
.map((p) => matchRoutes(routes, p))
.flat();
return Promise.all(matches.map((match) => match.route.component.preload?.()));
}