Repository navigation
fix(FileInput): dispatch changeAction and update optimistic value on clear and selection - #6427
Conversation
|
AI review status for this pull request.
|
PR Analysis Report📚 Storybook Preview🧪 Sandbox PreviewNo new or modified components detected. Bundle Size Summary
Accessibility AuditStatus: 1 accessibility violation(s) found — 1 serious. FileInput - 1 issue(s)
Visual Regression16 of 436 shot(s) changed. A change here is a question, not a failure: check whether the after is the
Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
There was a problem hiding this comment.
The implementation now follows the FileInput Transition Action contract for selection and clear, but one required regression check is still missing:
- Add assertions that
onChangeruns beforechangeActionfor both selection and clear. The current tests only verify that both callbacks fire, so they would still pass if this public ordering contract regressed. Recording both callbacks in one sequence would cover the requirement directly.
The focused FileInput suite, lint, sync check, and changeset validation otherwise pass.
[Automated review]
There was a problem hiding this comment.
The current revision resolves the remaining FileInput Transition Action review gap. Accepted file selection and explicit clear both run onChange before changeAction, and the tests directly verify that order together with optimistic selected/cleared state and aria-busy while Actions are pending.
The focused tests, lint, typecheck, sync check, and changeset validation pass. I found no remaining issue in the changed behavior.
[Automated review]
cixzhang
left a comment
There was a problem hiding this comment.
Thanks for getting the transition actions working here.
…clear and selection FileInput accepts a changeAction callback for React transitions. Previously handleClear invoked onChange(null) without calling changeAction, and handleFiles ran changeAction without updating optimistic state or exposing an optimistic busy indicator. Under the input fields family specification FR6, user mutations must invoke changeAction and present immediate optimistic feedback until the transition settles. This change tracks optimistic values through useOptimistic, dispatches changeAction on clear, reflects busy state on the trigger and content, and adds test coverage for pending transitions. Signed-off-by: Manohar Paturi <186662190+ManoharPaturi@users.noreply.github.com>
…ction and clear Under the input fields family contract (FR6), onChange runs before changeAction. Previously the FileInput tests asserted that both callbacks fired with the expected arguments, but did not assert execution sequence. Recording both callbacks in a single order array confirms that onChange runs first on both file selection and clear. Signed-off-by: Manohar Paturi <186662190+ManoharPaturi@users.noreply.github.com>
6255aa2 to
aaee15f
Compare

FileInput accepts a changeAction callback for React transitions alongside onChange. In the existing implementation, handleClear called onChange(null) without invoking changeAction, and file selection triggered changeAction without using useOptimistic to present immediate visual feedback while the transition was unresolved.
Under the input fields family contract documented in docs/families/input-fields.md (FR6), all user-driven mutations must dispatch through changeAction, present proposed values optimistically, and expose busy status while transitions are in flight.
This change introduces useOptimistic state tracking in FileInput, updates handleClear to run changeAction(null) inside startTransition, connects busy indicators to pending transitions, and adds unit tests covering changeAction execution and optimistic pending states.