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

Router fails to work properly on navigation #451

Open
LynithDev opened this issue Jun 17, 2024 · 7 comments
Open

Router fails to work properly on navigation #451

LynithDev opened this issue Jun 17, 2024 · 7 comments

Comments

@LynithDev
Copy link

Describe the bug

On some of the environments my app is being run on, the entire routing system fails to work, throwing an error in console:

Unhandled Promise Rejection: TypeError: undefined is not an object (evaluating 'match().path')

Seems to be coming from routing.ts

Thanks in advance

Your Example Website or App

.

Steps to Reproduce the Bug or Issue

  1. Attempt to navigate to a different route
  2. Error gets thrown

Expected behavior

Expected to navigate to a different route, however got an error and the entire router stopped working.

Screenshots or Videos

No response

Platform

  • OS: macOS 14.4.1
  • Browser: Safari (Specifically WebKit through Tauri)
  • Version: 17.4.1

Additional context

No response

@ryansolid
Copy link
Member

Yeah seems odd to happen intermittently or platform specific. It should be retrieving matches that exist. I haven't seen this before but a reproduction could probably help narrow this down quickly.

@LynithDev
Copy link
Author

That's the problem, I can't really reproduce it on my end either and a co-worker with a very similar setup (macOS + Safari/webkit as well) can't either.

@MarkLeMerise
Copy link

MarkLeMerise commented Jul 8, 2024

I think I was able to create a reproducible example. I do apologize as it's not perfectly minimal as it was adapted from a real-world usage that I've been troubleshooting for a few days, but I think it illustrates the problem well, which seems to stem from nested routes in combination with signals/computations run in the <Router> root component.

issue-451-solidjs-router

@formbook
Copy link

think this is related, happens regularly

20241027-170349
20241027-170447

@EndOfTheSpline
Copy link

I have the same issue using the current solid and solid-router.

  • In production builds, I've received reports that it happens frequently/almost always when performing certain actions (usually related to login/logout) and with certain browsers. Sometimes it happens to me as well, usually when the connection to the backend drops (and some loading screen appears briefly).
  • In development builds, it happens rarely normally, but frequently on the first route change after I restart my backend (which likely changes various states in the app).

I've tried to debug it in my application, and the error seems to disappear if I make sure that there's no <Show>{props.children}</Show> anywhere in the root component (and the next few components - simply outsourcing this bit into its own component and using it in the root component did not help). If there is a Show, and it changes its state at least twice, then it's guaranteed that the error happens on the next routing.

However... I've not been able to reproduce this Show-behaviour in a smaller sample yet. I'll see if I can strip down my application to figure out what could cause it to act that way.

I would be happy with a workaround for the time being too - I have an ErrorBoundary already set up, but it's a bit annoying if it happens somewhat frequently and hard to distinguish from other errors.

@weijarz
Copy link

weijarz commented Dec 17, 2024

This error also happened to me today when I upgraded router from 0.12.x to newest 0.15. This error seems to only appear on the '/login' page, and only when my login token expires, it redirects to this page and then this error appears. Backing out to 0.12 is no problem.

@weijarz
Copy link

weijarz commented Dec 17, 2024

I tried to create a minimal reproducible example, but I wasn't successful.
In my real app, the problem is with navigate('/login'), I delay it for a short delay (500ms) with setTimeout and it still comes up (Very high probability >90%). until I use a large interval (5000ms), and it stopped having problems.

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

No branches or pull requests

6 participants