fix(FileInput): dispatch changeAction and update optimistic value on clear and selection by ManoharPaturi · Pull Request #6427 · facebook/astryx · GitHub
Skip to content

fix(FileInput): dispatch changeAction and update optimistic value on clear and selection - #6427

Merged
cixzhang merged 2 commits into
facebook:mainfrom
ManoharPaturi:fix/file-input-clear-change-action
Oct 7, 2026
Merged

cixzhang merged 2 commits into
facebook:mainfrom
ManoharPaturi:fix/file-input-clear-change-action

Conversation

@ManoharPaturi

Copy link
Copy Markdown
Contributor

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.

Copilot AI lite review requested due to automatic review settings September 21, 2026 18:26
@vercel

vercel Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Sep 21, 2026
@astracat-bot

astracat-bot Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

AI review status for this pull request.

Review status Updated
⏳ Waiting for review (for maintainers only) Oct 7, 2026, 3:41 PM UTC

@github-actions github-actions Bot added community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge labels Sep 21, 2026
github-actions Bot added a commit that referenced this pull request Sep 21, 2026
@github-actions

github-actions Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR

🧪 Sandbox Preview

View Sandbox for this PR

No new or modified components detected.

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.9KB 1.2KB

Accessibility Audit

Status: 1 accessibility violation(s) found — 1 serious.

FileInput - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 3/15 stories · Learn more
    • WCAG: 1.4.3 (Level AA)

Visual Regression

16 of 436 shot(s) changed.

A change here is a question, not a failure: check whether the after is the
picture you intended. Record that review on the PR. Baseline maintenance is an
explicit dispatch of CI; this report never rewrites the baseline or adds a release gate.

component story theme mode pixels
Chat Full AI Chat probe light 155,733
Chat Full AI Chat probe dark 155,005
Chat Default neutral dark 33,205
Chat Default neutral light 32,876
Chat Empty State probe light 23,531
Chat Empty State probe dark 22,622
ChatAutoScroll Scroll Behavior Comparison neutral dark 15,378
ChatAutoScroll Scroll Behavior Comparison neutral light 14,107
Chat With Attachments probe light 13,229
Chat With Attachments probe dark 11,065
Markdown Default probe dark 897
Markdown Default probe light 897
Markdown Default neutral dark 882
Markdown Default neutral light 858
FileInput Default neutral light 44
FileInput Default neutral dark 42

Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The implementation now follows the FileInput Transition Action contract for selection and clear, but one required regression check is still missing:

  • Add assertions that onChange runs before changeAction for 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]

@ManoharPaturi

Copy link
Copy Markdown
Contributor Author

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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]

github-actions Bot added a commit that referenced this pull request Sep 23, 2026

@cixzhang cixzhang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for getting the transition actions working here.

@cixzhang
cixzhang enabled auto-merge (squash) September 29, 2026 02:32
@ManoharPaturi
ManoharPaturi requested a review from cixzhang October 3, 2026 02:43
…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>
@cixzhang
cixzhang force-pushed the fix/file-input-clear-change-action branch from 6255aa2 to aaee15f Compare October 7, 2026 14:57
@github-actions github-actions Bot removed the needs:code-review High-risk change (new package/component/API) — needs human code review before merge label Oct 7, 2026
@cixzhang
cixzhang disabled auto-merge October 7, 2026 15:20
@cixzhang
cixzhang enabled auto-merge (squash) October 7, 2026 16:40
@cixzhang
cixzhang merged commit 2cc4ec2 into facebook:main Oct 7, 2026
60 checks passed

This branch was successfully deployed

1 active deployment
Preview — aaee15f6 Deployed Oct 7, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. community Authored by a community contributor (not on the eng/design team)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants