mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-01 07:49:43 +02:00
fix(core): preload should support encoded page links (#7977)
Co-authored-by: Sébastien Lorber <slorber@users.noreply.github.com> Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com>
This commit is contained in:
parent
c2ce8a02e7
commit
75dc4a47e2
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 = Array.from(new Set([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