Skip to content

Commit

Permalink
update router-prefetcher/src/index.js getInitialData() matchPath opti…
Browse files Browse the repository at this point in the history
…on (#145)

fix the issue that exact flag is not being considered and multiple component.getInitialData() might be called
  • Loading branch information
ravelab authored and antonybudianto committed Feb 3, 2019
1 parent 16fdff1 commit 8c712ca
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/@cra-express/router-prefetcher/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { matchPath } from 'react-router-dom';

export function getInitialData(req, res, routes) {
const matches = routes.map((route, index) => {
const match = matchPath(req.url, route.path, route);
const { path, exact, strict } = route;
const match = matchPath(req.url, { path, exact, strict });
if (match) {
const obj = {
route,
Expand Down

0 comments on commit 8c712ca

Please sign in to comment.