I am migrating an app I started with the react template to Hotwire. I do not currently use any react components but any time I click a link in my app it requests it as TURBO_STREAM and does not change the page content. Should I be using Turbo and Stimulus through webpacker instead of gems?
Any js errors on browser console? Afaik, your requests will always be turbo_stream, but will be deferred to html whenever you don’t handle it specifically for turbo_stream…
Of you’re using webpack take a look at de docs, it describes how to add the libraries with yarn/npm.
No javascript errors, just warnings about deferred loading. I will see if using the webpack method changes anything.
Edit: Nope, no change and no errors or warnings in the console.
Can you place you GitHub repo , so that we can take a look?
Not yet. Here is a minimal repo showing an example of the issue: GitHub - coder2000/hotwire_test
So one thing you will notice is that if you remove the turbo-frame it will start working. In my code, I have a partial page being rendered like in the video and that page doesn’t load but others that do not have turbo-frames do.
Still having issues, I can get the pages to load if I refresh and they are processed as HTML but anything processed as TURBO_STREAM does not cause any content to be visible. @jonathanbruno
You have only one turbo frame tag, main …in the layout. I’m not sure it would work.
When using the turbo frame tag it ignores the layout… thus it is ignoring the tag which should exist in the response
Yeah, I guessed. When you remove that it works. However, in my actual codebase it still doesn’t.
Ok, so I got it working. It doesn’t like having the gem installed with the npm package. I wasn’t sure how to get it working with webpacker otherwise. I lose access to the helper but can either make my own or copy it into my own helpers.
Edit: Actually, if I read things properly you can use both webpacker and hotwire, I just screwed up the install by having a haml template instead of ERB so it didn’t install the correct javascript. I will go back and fix my code.