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

Refactor Redirect component to support dynamic URL parameters #5748

Merged
merged 1 commit into from
May 5, 2023

Conversation

HelNershingThapa
Copy link
Contributor

Closes #5737

Peek 2023-05-02 10-55

  • Updates the Redirect component to support dynamic URL parameters. Previously, the component redirected to a static URL provided in the to prop. It extracts any necessary parameters from the current URL using useParams, constructs the appropriate URL based on the to prop and any extracted parameters, and then redirects to that URL using useNavigate.
  • Extracts the Redirect component into a separate file in src/components/redirect.js
  • Adds a test to cover the scenario that redirects from /project/XXX to /projects/XXX router

- Updates the Redirect component to support dynamic URL parameters. Previously, the component redirected to a static URL provided in the to prop. Now, it extracts any necessary parameters from the current URL using useParams, constructs the appropriate URL based on the to prop and any extracted parameters, and then redirects to that URL using useNavigate.
- Extracts the Redirect component into a separate file src/components/redirect.js
- Adds test to cover scenario that it redirects from /project/XXX to /projects/XXX router
@sonarcloud
Copy link

sonarcloud bot commented May 2, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Contributor

@d-rita d-rita left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as expected. LGTM

@HelNershingThapa HelNershingThapa merged commit 916347f into develop May 5, 2023
5 checks passed
@HelNershingThapa HelNershingThapa deleted the fix/5737-project-redirect branch May 5, 2023 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Redirect from /project/XXX to /projects/XXX not working after migration from @reach/router
3 participants