Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirect is not computing the params from the from path to the to path #5753

Closed
Sparragus opened this issue Nov 24, 2017 · 4 comments
Closed

Comments

@Sparragus
Copy link

Version

4.2.2

Test Case

Code: https://github.com/Sparragus/react-router-redirect-bug/blob/master/src/App.js
Demo: https://redirect-bug-cbfahyusjk.now.sh/

Steps to reproduce

  1. Go to https://redirect-bug-cbfahyusjk.now.sh/
  2. You will be automatically redirected to /users (This is expected behavior)
  3. Click on "@Sparragus". You will go to /users/sparragus. (This is expected behavior)
  4. Go back to /users
  5. Click con "@horse_js". You should be redirected from /profile/horse_js to /users/horse_js. However, you will be redirected to /users/:username. (This is unexpected behavior).

Expected Behavior

When clicking on the link to @horse_js's profile at /users, you are redirected from /profile/horse_js to /users/horse_js.

Actual Behavior

When clicking on the link to @horse_js's profile /users, you are redirected from /profile/horse_js to /users/:username.

@Sparragus
Copy link
Author

Sparragus commented Nov 24, 2017

This should be working, but I think Redirect is not receiving the computedMatch props.
https://github.com/ReactTraining/react-router/blob/73348d9c7fdfed0d3c29fea20e2d49d2651dbeab/packages/react-router/modules/Redirect.js#L70

This prop should be passed by Switch to the Redirect but it seems something is buggy and this isn't happening.
https://github.com/ReactTraining/react-router/blob/73348d9c7fdfed0d3c29fea20e2d49d2651dbeab/packages/react-router/modules/Switch.js#L57

@Sparragus
Copy link
Author

Sparragus commented Nov 24, 2017

Currently I'm doing this as a workaround: #4919 (comment)

@pshrmn
Copy link
Contributor

pshrmn commented Nov 24, 2017

I believe this is the feature that you're referring to #5209. It has been merged, but there hasn't been a release since then.

@Sparragus
Copy link
Author

@pshrmn Oooooh. Looking forward to it! Thanks :)

@lock lock bot locked as resolved and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants