Failed to parse URL from after refreshing page
I am using solid-start with bun. I created a page where i am fetching data using createResource. I have index page which redirects me to /page/<id>. And then I am fetching data using this id and it works fine. But then when I am refreshing this page i get this error TypeError: Failed to parse URL from /api/data/<id>
5 Replies
if you're using
fetch
on the server you need to include a base URL, just doing fetch("/api/data/...")
won't work
since the server doesn't know its own urlbut why it does work on first load, but no on the refresh?
bc going from
/
to /page/<id>
is a client-side operation, ssr only occurs on initial load
fetch doesn't need a base url on the clientso there is no any adventages when user go to any url from index page? ithought everything is loaded on ssr for performance
ssr on initial load is designed to minimise metrics such as time to first byte, once the page has loaded and you're navigating around it's usually just as fast to render on the client
since at that point you can preload things in anticipation of navigations
also doing ssr every time means your client-side state would be wiped out on every navigation