Search code examples
react-routerhistory.jsrelayjs

Duplicate parent paths in url bar


Using:

"react-router": "^2.0.0",
"react-router-relay": "^0.9.0",

When I push any link under a parent path, the parent path is duplicated in the URL bar once for every new router.push call.

// http://localhost:3000

router.push('auth/profile')
// http://localhost:3000/auth/profile

router.push('auth/profile')
// http://localhost:3000/auth/auth/profile

router.push('auth/browse')
// http://localhost:3000/auth/auth/auth/browse

When I log the location (from react-router), it does not show the duplicates. Maybe the browser is pushing the parent path onto the basename?


Solution

  • Changing

    router.push('auth/profile')
    

    to

    router.push('/auth/profile')
    

    fixed this.