Open
Conversation
Rails ships Stimulus by default, making it the natural host for client-side validation lifecycle management. The previous runtime auto-booted from a UMD bundle served by Sprockets or Webpacker, required manual enable/disable calls, and used a custom jQuery-era event loop that did not handle dynamically inserted fields. This commit replaces all of that with a single Stimulus controller (identifier: client-side-validations) that owns the full lifecycle: - Form context is installed in connect() and torn down in disconnect() - Validated inputs are declared as Stimulus targets; new inputs added via Turbo Stream, cocoon, or nested-form are picked up automatically through inputTargetConnected / inputTargetDisconnected - Confirmation fields use a dedicated 'confirmation' target with a data-client-side-validations-confirms attribute pointing to the primary field's id - Settings travel as a Stimulus value (data-...-settings-value) so the controller owns both config and lifecycle with no global state Breaking changes: - window.ClientSideValidations global and its enable/validate/disable/ reset API are removed; use the Stimulus controller lifecycle instead - data-client-side-validations attribute replaced by the settings value - UMD bundle and Sprockets/Webpacker asset generators removed; the gem now ships a single ESM bundle consumed via the npm package - ajax:beforeSend / remote: true integration removed; validation runs on the native submit event - Stimulus >= 3.2 is now a peer dependency The install generator now copies a Stimulus controller stub into app/javascript/controllers/ alongside the existing initializer. A new Config.stimulus_controller_name option allows projects to mount the controller under a custom identifier. Close #929
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.
No description provided.