Hey @Ole!
No worries :). It IS imported from `app.js` - we did it WAY back on chapter 11 - https://symfonycasts.com/screencast/turbo/organize#codeblock-b154ca5114
Let me know if that helps!
Cheers!
I'm sorry, I did not completly understand, how is the turbo-helper instantiated? Does/should it happen automatically, oder do i have to create it from within app.js manually?
Thank you for your answer. I finished the course, and the video didn't give an answer. I needed to disable turbo in registration form to see form validation errors with `data-turbo="false"`
Yo @jmsche!
Sorry for the late reply. Why can this be skipped now? I think I missed some new Turbo feature - please tell me! :)
Cheers!
I have a working example of paused rendering and it takes quite a bit.
Here's the core of how you do it:
1. Create a listener for `turbo:before-render` on `document`
2. In the callback you assign to this listener:
1. Pause rendering…
…a case of rewriting the code in Stimulus. I'm going to press on with the tutorial, I'm only at the beginning so need to understand more about Stimulus and Turbo before attempting anything but thank you so much for the detailed response.
Steve
Thank you very much. I will try to implement all your recommendations. It's true that I haven't practiced enough in the Turbo and stimulus technologies yet. It's probably time to put myself on it.
…perfectly normal `` tag. And when they follow the link, they will load (and index) the full page that renders when you go to `/products/blow-up-sofa/couch`. Turbo Frames are a nice bit of magic, but they fall back to real, functional, boring pages.
…
|
|
// ... lines 1 - 27
|
|
<turbo-frame id="mix-browse-list-{{ pager.currentPage }}"> |
|
<div class="row"> |
|
|
// ... lines 30 - 47
|
|
{% if pager.hasNextPage %} |
|
<turbo-frame id="mix-browse-list-{{ pager.nextPage }}" src="{{ pagerfanta_page_url(pager, pager.nextPage) }}" loading="lazy"></turbo-frame> |
|
{% endif %} |
|
</div> |
|
</turbo-frame> |
|
|
// ... lines 53 - 56
|
See Code Block in Script
Hey @weaverryan,
this is exactly the problem. I loads correctly on first page load, but fails on subsequent turbo visits. I will try out your proposal, thanks for that!
My hypotheses at the moment (after downloading the source code of the widget and trying to…
…after each Turbo navigation? Or is it something else? Assuming that this widget adds some new markup to the bottom of your page that you want to keep, you could, in theory (though I've never tried this), via JavaScript add a `data-turbo-permanent…
…nested stimulus controllers and the child one inside a turbo frame like this:
```
```
The method_name in controller_2 is executed only when the frame is loaded for the first time, but if the same content is reloaded in the frame through Turbo frame mechanism…
…Set();
document.addEventListener('turbo:before-fetch-request', (event) => {
const url = event.detail.url.href;
if (urls.has(url)) {
event.preventDefault();
} else {
urls.add(url);
}
});
```
Would have been great having a buit-in for this behaviour (something like you mention like data-turbo="restore")…
…question is: Is there any way to keep the Snapshop previously created when user clicked LinkA for the second time? The objective of this approach is not reloading the same content twice. This behaviour could happen inside a turbo-frame as well.
Thanks a lot!
…
Hmm. Have you added any JavaScript yet to try to "clean up" or "close" the Offcanvas before Turbo caches the page - like we did with the modal? https://symfonycasts.com/screencast/turbo/cleaned-preview#codeblock-ee773c0b6d
This stuff can be... oddly tricky - so let me…
…backdrop being added multiple times, like the JS is being executed every time (as you mentioned in a previous video) I change page with turbo (backdrop continually gets darker) and it will clear if I do a full page reload. How can this be fixed…
…And so, there's nothing you can do. But I don't think it's a huge deal: use Turbo where you can, and skip it where you can't.
I'd love to see EasyAdmin refactor their JavaScript to use Stimulus. Their JavaScript isn…
…more recently Easy Admin.
I just saw that EasyAdmin disabled UX-turbo because of some conflicts with their body javascripts loads and so on ...
https://github.com/EasyCorp/EasyAdminBundle/commit/f3a4b13382f6d96f85b0b1d8dfe329f40a39d32c
"Refactoring everything to be turbo-compatible would be titanic effort with little benefit"
Would…
…It *sounds* like Turbo is somehow being initialized *twice*. Internally, Turbo registers `turbo-frame` as a custom element (on CustomElementRegistry). So the error seems to be clearly saying that... this is somehow happening twice!
Is there anything special with your setup? Before you installed Turbo..…
…yoelkj!
Hmm, those are really weird errors! The error mentions `companion-bubble.js` - I think that might be from a Chrome extension - perhaps one called "Loom". So this error may be unrelated to the Turbo stuff, which is why the site is working ok :).
Cheers!
x
682