Compare commits
3 Commits
main
...
fix/preloa
| Author | SHA1 | Date |
|---|---|---|
|
|
98957bbeaf | |
|
|
31591a3877 | |
|
|
021158a02d |
|
|
@ -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…
Reference in New Issue