You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{typeRouteDefinition}from'@solidjs/router'import{cache,createAsync,redirect}from'@solidjs/router'import{getRequestEvent}from'solid-js/web'constexampleAction=cache(async()=>{'use server'constlocation=newURL(getRequestEvent()!.request.url)returnredirect(`${location.origin}/target`)},'exampleAction')exportconstroute={load(){// redirect will start working if uncommented:// void exampleAction()},}satisfiesRouteDefinitionexportdefaultfunctionComponent(){constdata=createAsync(()=>exampleAction())return<h1>Result: {data()}</h1>}
With the route above, when you navigate to /redirect, it does not redirect you to /target.
Unless you trigger an action with redirect inside route.load or use a relative redirect which starts with / instead of a full URL with the origin, i.e., redirect('/target') works, but redirect('http://localhost:3000/target') does not.
Your Example Website or App
N/A
Steps to Reproduce the Bug or Issue
Use the above code in an SSR route
Expected behavior
Redirect happens without a load function.
Screenshots or Videos
No response
Platform
N/A
Additional context
Am fixing this rn
The text was updated successfully, but these errors were encountered:
Describe the bug
From solidjs/solid-start#1512 (comment)
Your Example Website or App
N/A
Steps to Reproduce the Bug or Issue
Use the above code in an SSR route
Expected behavior
Redirect happens without a load function.
Screenshots or Videos
No response
Platform
N/A
Additional context
Am fixing this rnThe text was updated successfully, but these errors were encountered: