Remove @rails/ujs#4074
Draft
tvdeyen wants to merge 3 commits into
Draft
Conversation
tvdeyen
force-pushed
the
element-editor-turbo-stream
branch
from
July 19, 2026 09:18
caaf57d to
78fcc6f
Compare
tvdeyen
force-pushed
the
remove-rails-ujs
branch
from
July 19, 2026 09:33
7a46ac6 to
e2bde52
Compare
The element editor save was the last remote form driven by @rails/ujs; with it converted to Turbo, nothing in the admin depends on UJS anymore. No remote forms or links remain, all destructive links are Turbo forms or use data-turbo-method/confirm, and the only Rails.* call left was Rails.start(). This removes the library (import, Rails.start(), the importmap pin, the vendored rails-ujs.min.js, the package.json dependency and the rollup external) together with its now-dead consumers: the dialog's watch_remote_forms handler, the vestigial remote: plumbing in the kaminari pagination theme (no caller ever enabled it, so the links were already plain Turbo Drive navigations), and the server-side js.erb responses (redirect, permission_denied, error_notice) that only ran because UJS auto-executed a text/javascript response. Nothing requests a :js format anymore, so those format.js branches were unreachable.
alchemy_form_for defaulted the form to a UJS remote request for XHR requests. With @rails/ujs gone that default no longer does anything, and every caller already opted out of it with remote: false. Drop the defaulting and the now no-op remote: false arguments.
redirect_or_render_notice answered an XHR permission denial with a respond_to that rendered plain text for a text/javascript (UJS remote) request and the flash partial for everything else. Only a UJS client ever asked for the JavaScript variant, so render the flash partial directly.
tvdeyen
force-pushed
the
remove-rails-ujs
branch
from
July 19, 2026 09:47
e2bde52 to
46dc0f4
Compare
tvdeyen
marked this pull request as draft
July 19, 2026 10:05
Member
Author
|
Blocked: converting to draft. CI surfaced that admin dialog forms depend on @rails/ujs — a form rendered in a dialog is implicitly made |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is this pull request for?
Built on top of #4069. That PR converted the element editor save — the last
admin form driven by
@rails/ujs— to Turbo, which leaves nothing in the admindepending on UJS. This removes the library and its remaining dead footprint.
There are no remaining remote forms or links, every destructive link is a Turbo
form or uses
data-turbo-method/data-turbo-confirm,utils/ajaxhandles itsown CSRF token, and the only
Rails.*call left wasRails.start()itself.Removed:
The library — the
import Rails from "@rails/ujs",Rails.start(), theimportmap pin, the vendored
rails-ujs.min.js, thepackage.jsondependencyand the rollup
externalentry.Its dead consumers — the dialog's
watch_remote_forms(it boundajax:success/ajax:erroron[data-remote="true"]forms, of which there arenone); the vestigial
remote:plumbing in the kaminari pagination theme (nocaller ever passed it, so the pagination links were already plain Turbo Drive
navigations, not
data-remote); and the three server-sidejs.erbresponses(
redirect,permission_denied,error_notice) with theirformat.jsbranches. Those only did anything because UJS auto-executed a
text/javascriptresponse — nothing requests a:jsformat anymore, so theywere unreachable.
Notable changes (remove if none)
Requests that reach
do_redirect_to,show_error_noticeor the guestpermission-denied path with a
:jsformat previously rendered ajs.erb; theynow fall through to the
turbo_stream/html/500/redirect branches that real(Turbo and
fetch) clients already use.Checklist