Open navro opened 7 years ago
There are some fancy discussions in this Issue, regarding making the scripts idempotent.
For the calendar scripts I would say: $('#event_calendar').html("");
In the beginning of the initialisations should help!
I bet you could do something similar with Select2.
You can add:
$(document).addEventListener("turbolinks:before-cache", function() {
$('.select2').select2('destroy');
$('.select2_tags').select2('destroy');
})
To the select2
-loader and it should do the trick :).
Based on:
Might be nicer to solve the fullcalendar-issue the same way, but then you need another destroy method :)
Got the calendar to work using $('#event_calendar').html("");
, but not select2 😞
@navro did you try the turbolinks:before-cache
?
@navro did you try the turbolinks:before-cache?
Yes, that's the one i tried
I found the solution!
You should not use select2
as the classname for loading select2 on, then you get issues.
https://github.com/aldeed/meteor-autoform-select2/issues/44#issuecomment-231216235
We really should fix this little bug... Thanks for the solution @davidwessman, don't know why we haven't fixed it yet 😞
Visit https://fsektionen.se/kalender or a page with a select2 controller. Navigate to another page. Press the back button in the browser. The calendar/select2 controller is now duplicated!
How do we fix this? Any idea @davidwessman? I love turbolinks 5...