Update packages/docusaurus/src/client/preload.ts

Co-authored-by: Sébastien Lorber <slorber@users.noreply.github.com>
This commit is contained in:
adventure-yunfei 2022-08-25 16:41:34 +08:00 committed by GitHub
parent 021158a02d
commit 31591a3877
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,7 +17,7 @@ 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 = [pathname, decodeURI(pathname)]
const matches = Array.from(new Set([pathname, decodeURI(pathname)]))
.map(p => matchRoutes(routes, p))
.flat();