-
Notifications
You must be signed in to change notification settings - Fork 432
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
turbo:load won't be triggered when a FormSubmission request fails #85
Comments
This is by design. The |
So, the PR #39 is useless? We often use |
You shouldn't listen for the The Hotwire way is to put the code you want to run in the |
I see, thanks. |
@sstephenson Silly question, the page does get replaced though (it re-renders the old page triggering a turbo:render event). |
I find the decision not to fire the
So that means that if my form has some JS in it (ex. booting a bootstrap-datepicker with jquery, launching a google autocomplete...), the JS is not re-initialized but the the DOM has changed. I ended up using |
Does this mean that all of our existing legacy code that once was based on: But the Stimulus Handbook indicates that this might get triggered twice:
Which could be problematic because some of that legacy js gets torn down on It would be great if there were a bit more backward compatibility with turbolinks... |
I ended up booting 3 times: Because React seems to be idempotent, and our codebase seems to be as well, we haven't noticed a major memory leak or slowness. Still, this is upsetting because it's not advertised as such. What I understand is that only stimulus code is automatically re-booted if necessary, but external dependencies are to be either idempotent and booted multiple times, or booted once and hope for no re-render @sstephenson ? |
I also have a react component that I attached using adding document listerner for
if that's so
|
One year later, do we have a proper workaround for this? Is turbo really encouraging us to use an event that is fired twice? Thanks! Solution: #520 (comment) |
…riggered after 422 * hotwired/turbo#85
When a FormSubmission request fails and return 400-500 code,
turbo:load
won't be triggered. eg:application.js
new.html.erb
posts_controller.rb
After submit form, it should show
demo replace
, but it showeddemo
because ofturbo:load
hasn't be triggered.More info SimoTod/alpine-turbo-drive-adapter#29 (comment)
The text was updated successfully, but these errors were encountered: