Skip to content
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

Add basic support for hotwired/turbo in the backend #7011

Draft
wants to merge 4 commits into
base: 5.x
Choose a base branch
from

Conversation

m-vo
Copy link
Member

@m-vo m-vo commented Mar 12, 2024

This is the first attempt to add Turbo in the backend. This does not yet enable frames or uses streams at any place but enables drive by default. We will likely need to disable it by default and then enable it again for specific scenarios but this is a good starting point to see what would actually break.

For now these are the things we are doing:

  • Disable prefetch for all URLs that contain a rt query parameter, so that things like GET requests to delete resources won't be triggered.
  • Change the returned status code to 422 in the BackendController if a widget was rendered with an error, so that forms still work.
  • Disable it for the login form (because it's a completely different structure).
  • t.b.c.

@m-vo m-vo added the feature label Mar 12, 2024
@m-vo m-vo added this to the 5.4 milestone Mar 12, 2024
@m-vo m-vo self-assigned this Mar 12, 2024
package.json Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
@m-vo m-vo force-pushed the turbo branch 4 times, most recently from a150347 to a179f30 Compare March 12, 2024 16:16
core-bundle/assets/backend.js Outdated Show resolved Hide resolved
m-vo and others added 3 commits March 12, 2024 22:57
Copy link
Contributor

@fritzmg fritzmg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two issues that I noticed:

  • When going from any page to the file manager, there will be a JS error regarding DropZone. This is because the DropZone JavaScript is only added there - which is ignored by Turbo by default (without data-turbo-track="reload").
  • For some reason the navigations panes in the main nav are getting toggled randomly sometimes, when navigating with Turbo Drive.

@fritzmg
Copy link
Contributor

fritzmg commented Mar 12, 2024

We also need to change all form.submit() calls with form.requestSubmit() in order for these form submits to be turböd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants