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

Navigate cannot find page when running in StrictMode #10320

Open
jbojcic1 opened this issue Dec 10, 2024 · 0 comments
Open

Navigate cannot find page when running in StrictMode #10320

jbojcic1 opened this issue Dec 10, 2024 · 0 comments

Comments

@jbojcic1
Copy link

jbojcic1 commented Dec 10, 2024

Reproduction

  1. Go to https://stackblitz.com/edit/remix-run-remix-tvkf76fm
  2. Run the app
  3. Click Log in and notice 404 error with Error: No route matches URL "/verify-email" message in console
  4. Reload the page to see that /verify-email pages displays fine

Now to demonstrate how the issue is not there when StrictMode is disabled:

  1. Clear the local storage (fakeUser must be removed)
  2. Go to entry.client.ts file and remove <StrictMode> that wraps <RemixBrowser>
  3. Reload the app, click Log in and notice how it redirected to /verify-email page correctly now

System Info

System:
    OS: macOS 15.1.1
    CPU: (10) arm64 Apple M1 Max
    Memory: 2.82 GB / 64.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.11.0 - ~/.local/state/fnm_multishells/63532_1733486148999/bin/node
    Yarn: 1.22.22 - /opt/homebrew/bin/yarn
    npm: 10.9.0 - ~/.local/state/fnm_multishells/63532_1733486148999/bin/npm
    pnpm: 8.6.10 - /opt/homebrew/bin/pnpm
    bun: 1.1.34 - /nix/store/xnj00gq1mfffvgyisghk4m9f38gc5c5c-bun-1.1.34/bin/bun
  Browsers:
    Brave Browser: 128.1.69.168
    Chrome: 131.0.6778.109
    Safari: 18.1.1
  npmPackages:
    @remix-run/dev: 2.15.0 => 2.15.0 
    @remix-run/express: 2.15.0 => 2.15.0 
    @remix-run/node: 2.15.0 => 2.15.0 
    @remix-run/react: 2.15.0 => 2.15.0 
    vite: 5.4.11 => 5.4.11 

Used Package Manager

bun

Expected Behavior

The redirect performed with navigate should work fine in both strict and no strict mode.

Actual Behavior

The redirect performed with navigate works fine only in strict mode. There seems to be something wrong when navigate is called twice for the same page (it happens in StrictMode because I am performing navigate from useEffect and StrictMode runs effects twice in development).

Btw I am doing navigation from the useEffect because in my app I must do client side navigation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant