Replies: 1 comment 2 replies
-
Can you provide an example repository? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I'm using the static adapter to generate static files for my app. I have a few dynamic routes. E.g. I have
files/owned
andfiles/shared
which display a list of files. Since the code behind them is pretty similar and it is likely that there will be more filters in the future, I put those behind a dynamic routefiles/[filter]
. I export an entries property to make Sveltekit aware of them so they get prerendered:This works great.
Now I want to make a dynamic route with an unknown amout of variations. E.g.
filebrowser/[fileId]
. To make the app build, I disabled the prerender option for this route:export const prerender = false;
. The app builds and everything works fine if I navigate from any page in the app to my file browser, because the client side router handles everything. But when I navigate to my file browser as initial page visit (no client side router to handle and intercept the navigation) then the app breaks. Initially I thought this was due to some misconfiguration of the fallback page. I've setfallback: '200.html'
in my adapter configuration and I serve the200.html
on every not found file. Now when I visit the page with my filebrowser as an entrypoint, I get a white screen. Looking into the network tab, I see only successful requests. My console saysUncaught (in promise) SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
. I think this happens, because the browser requestsfilebrowser/1234/__data.json
which does not exist and gets answered with my200.html
.How do I fix this and what even is the
__data.json
I'm missing?Thanks for your time & help!
Beta Was this translation helpful? Give feedback.
All reactions