Vite entrypoint being hit, but the component is not being rendered... #403
-
First of all, this gem is awesome. I hope it never dies. Problem:Everything seems to be working as expected, right up until the response hits the Vite entrypoint. Everything seems to stop there.
Things I've tried:
I just can't figure out why the html would never actually make it to the page. Is this a load order issue? Something else? I feel like I've pored over the docs, issues, PRs, google, and haven't found anyone experiencing anything similar. Any advice/help is greatly appreciated! Request response:![]() Vite entrypoint:![]() What's in the dom:![]() Pages setup:![]() |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 10 replies
-
From the "What's in the dom" screenshot it looks like the partial is being generated correctly, no? Is the If it is being executed, then the problem is with the imports. If the script is not being executed at all, then the issue probably lies in the vite configuration? |
Beta Was this translation helpful? Give feedback.
-
From the request response it seems like a full page redirect, If you add something to users/new.html.erb, will it show on the page? |
Beta Was this translation helpful? Give feedback.
-
@planetaska @ElMassimo
At this point, I don't know if I'm trying to use this in the wrong way, or what, but I'm not sure how anyone would use this setup to navigate between routes/resources successfully. I can get the main page to load (no matter what I put in there), but that's about it. 😞 Trying to navigate or fetch resources and display a new view is unsuccessful. To me it seems clear that the call is being made to the backend successfully, and the server is responding successfully, but something breaks when the response is received on the client side. Like you said, @planetaska, it seems strange that the response code is missing the additional strings in the div id, but I'm not sure why that would be or where to begin debugging that. I did get your example repo working, but it also lacks the trailing random strings when I run it locally, and since it's just the one page that's rendering a Svelte component, I still can't tell if I'm doing something wrong in order to keep the FE more segregated from the BE. Thank you for helping me think through this, by the way. I really appreciate it! @ElMassimo should I make this an issue (either here or in the I can also push up and share what I'm working on if someone would like to see what I'm working with. Does anyone know if there is a working example repo that features navigation between pages/routes/views that I can poke around in?All the ones I've come across are a single page with not much else going on (something I could make with plain Svelte/Vite), or ones that I'm also not able to get to work (like this one). |
Beta Was this translation helpful? Give feedback.
-
@ElMassimo here's a repo that you can clone. After pulling you'll just need to:
|
Beta Was this translation helpful? Give feedback.
The way it's currently setup, clicking the button makes an XHR request:
However, the server responds with HTML, so nothing happens.
Instead of fetching the result, it sounds like you would want to navigate to that page. JS From Routes helpers provide a
path
method that you can use in links:After fixing a typo:
If you plan on using Svelte components as pages, I highly recommend that you check out Inertia, as it would enable client-side navigation without adding any boilerplate.