RRUI-016 · RapidRailsUI defect

Upload controller leaves the native FileList stale

The upload controller updates its preview state but does not synchronize the native file input after drag-and-drop, cumulative selection, or removal.

Openrapid_rails_ui v0.58.1reported 2026-10-05

Upstream triage requested. This was found while following the standard RapidRailsUI installation guide in a vanilla Rails 8 application using Importmap and Tailwind CSS v4.

At a glance

Component`upload_controller.js`
ObservedThe controller stores accepted files in `this.files` and renders previews, but `inputTarget.files` is never rebuilt. Dropped files and files added across selections are not submitted, while removed preview files can remain in the native input.
ExpectedThe native file input should contain exactly the currently accepted files at form submission time.
ImpactForms can silently omit files the user selected or upload files the user removed from the preview.

Reproduction

1. Render a RapidRailsUI upload with `multiple: true`.\n2. Select or drop a file and inspect the preview.\n3. Submit the form or remove the file, then inspect the native input's `FileList`.\n4. Observe that the preview state and submitted file list diverge.

Suggested direction

After validation and removal, rebuild the input `FileList` from the accepted files using `DataTransfer`.

Consumer workaround

Patch the controller to call a `DataTransfer`-based synchronization method after every accepted selection and removal.