solid-router icon indicating copy to clipboard operation
solid-router copied to clipboard

[BUG] Error from cached load() is passed to the createAsync result as value

Open madaxen86 opened this issue 1 year ago • 2 comments

Describe the bug

May be related to #374 When the function that is passed to the routes load() function throws an error or rejected promise, the error will be passed to the result primitive as a "successful" value if the page is refreshed and then clicked on a link to the current page (please check the video).

Your Example Website or App

https://github.com/madaxen86/solid-router-cache-load-bug.git Stackblitz -> Note: Unlike in the attached video the error now is on the index route.

Steps to Reproduce the Bug or Issue

  1. Open code sandbox
  2. Navigate between test and home page -->all good. Errorboundary is rendered
  3. Go to test page
  4. refresh the window
  5. click on test navlink --> page is rendered with the data primitive containing the error string !?

Expected behavior

The error should always be picked up by the ErrorBoundary and never passed to the primitive returned by the createAsync function.

Screenshots or Videos

https://github.com/solidjs/solid-router/assets/59310516/d855df9c-35a2-4d46-b387-7c64a1134f56

Platform

@solidjs/router: 0.12.4 @solidjs/start: 0.6.0

Additional context

No response

madaxen86 avatar Feb 28 '24 18:02 madaxen86

Yeah this one is odd.. codesandbox is not being particularly helpful to me because they have a limit now on drafts unless I pay so I can't play with this much other than confirm the reproduction and that it isn't the same as the other issue. Beyond that this one is very specific to loading on the page... so there probably is an issue related to cache + hydration. I will try to look into this more in a bit.

ryansolid avatar Mar 04 '24 19:03 ryansolid

I added a stackblitz - here the error is on the home page because stackblitz reloads o on the home route when reloading the url. Added a Github repo so you can dig into it. Thanks a lot and thanks for this amazing framework. It is such a pleasure to work with SolidJs.

madaxen86 avatar Mar 04 '24 20:03 madaxen86