I'm having trouble migrating my Pagy pagination from Turbolinks to Turbo!
I posted about it here: https://discuss.hotwire.dev/t/pagy-infinite-scroll-and-get-post-requests/2853.
If anybody can help me, that'd be much appreciated. Thank you!
Posted in Pagination with Stimulus
Hi Brad, did you manage to solve this issue? I'm stuck on something similar right now!
I've managed to get forms working using
status: :unprocessable_entity against my calls to
render for error cases.
However, some of my form pages are long, and so while the flash messages are correctly displayed when the page re-renders, they are off screen at the top. With Turbolinks, the pages would naturally reload at the top of the page.
Anybody know the best way to handle this case?
I’ve been using the Freshdesk widget on my production app for a while now. I want to be able to pre-fill a user's email address as well as automatically set the ticket priority for my paid users to "High".
I've got it set up such that on the initial website loads or page refreshes, everything works as is expected, but when navigating from page-to-page within the app, only the widget is initialised, but none of the extra stuff is set up.
Here's how my code is set up.
app/views/layouts/application.html.erb, just before the closing
</body> tag, I have:
<%= render "layouts/freshdesk_widget" %>
app/views/layouts/_freshdesk_widget.html.erb, I have the following:
I’ve tried many different things, from trying to call the code in different places, to trying to manually do what I want, but to no avail.
Ever since I started using this widget, when navigating to other pages after the initial page load, I always get the following error in my console:
VM2797 <widget_id>.js:1 Uncaught TypeError: Cannot read property 'postMessage' of null at Object.postMessage (VM2797 <widget_id>.js:1) at Object.widgetRenderComplete (VM2797 <widget_id>.js:1) at Object.handleMessage (VM2797 <widget_id>.js:1)
I did get rid of these errors by putting the embed code in the
application.html.erb, but it meant the widget didn’t load again beyond the initial page load. So, I put everything back to where the documentation said it should go and have just been ignoring the error message. I wonder whether it has any bearing on the problems I’m having now.
Thank you in advance for any help I get! Let me know if you have any more questions or need to see more parts of the code.
P.S. I know it's Turbolinks causing the issue because when I disable it, everything works as expected. However, I heavily rely on Turbolinks in other parts of the application!