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

Bug report: Calling navigate more than once causes 404 error #12853

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Bastian
Copy link

@Bastian Bastian commented Jan 24, 2025

When calling the navigate functions multiple times immediately after the initial rendering in a useEffect hook, the website shows a 404 error even though the route exists. This does not happen, if the calls to navigate are delayed.

image

This is very likely to happen in dev mode with strict mode enabled, since then React executes the useEffect hook twice. I do not know how to do this with your test template, so to simulate a similar behavior I just called the navigate function twice.

image

I did not have this problem with Remix v2. Correction: It also happens with Remix 2.15.2 and all feature flags enabled. But it used to work in older (2.11.1) Remix versions without feature flags. I don't know when exactly it broke.

Copy link

changeset-bot bot commented Jan 24, 2025

⚠️ No Changeset found

Latest commit: 612b20c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@remix-cla-bot
Copy link
Contributor

remix-cla-bot bot commented Jan 24, 2025

Hi @Bastian,

Welcome, and thank you for contributing to React Router!

Before we consider your pull request, we ask that you sign our Contributor License Agreement (CLA). We require this only once.

You may review the CLA and sign it by adding your name to contributors.yml.

Once the CLA is signed, the CLA Signed label will be added to the pull request.

If you have already signed the CLA and received this response in error, or if you have any questions, please contact us at [email protected].

Thanks!

- The Remix team

To make the CLA bot happy. Is this really neccessary for a bug report?
@remix-cla-bot
Copy link
Contributor

remix-cla-bot bot commented Jan 24, 2025

Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳

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.

1 participant