Skip to content

fix(PowerSearch): Done on a field that became read-only while the sheet was open reports nothing - #9914

Merged
imdreamrunner merged 1 commit into
mainfrom
fix/powersearch-sheet-done-read-only
Nov 4, 2026
Merged

imdreamrunner merged 1 commit into
mainfrom
fix/powersearch-sheet-done-read-only

Conversation

@imdreamrunner

Copy link
Copy Markdown
Contributor

Symptom

In PowerSearch's sheet presentation, a field that became read-only while the flow was open (a controlled isReadOnly flip mid-session; a disabled field closes the flow from outside) still reported its draft on Done. The onChange-prop and draft-edit JSDoc in PowerSearchBottomSheet.tsx also described Done's calls as "the list as it stood after that edit", where Done replays each edit onto the field's latest filters.

Root cause

commitAndClose replayed the draft whenever it differed from the filters at open, with no check that the field could still be edited. The two comments predate the replay's rebase onto the latest filters.

Fix

  • Done replays the draft only while the field is interactive (isDraftDirty && isInteractive); a read-only or disabled field at Done drops the draft and closes, as the Tokenizer sheet does for a disabled field (component:Tokenizer FR26).
  • The onChange prop's JSDoc says Done replays the edits onto the field's latest filters, each call carrying that list with the edit applied, nothing before Done and nothing when the field is read-only or disabled at Done; the DraftEdit JSDoc says what it records and how Done uses it.

Record

component:PowerSearch FR15b gains the sentence: Done on a field that became read-only or disabled while the flow was open reports nothing and closes, the draft dropped. Present tense; the pending [feat] changeset for the unreleased presentation prop carries the clause (coverage asked for a changeset naming core).

Writing rubric results

  • R1 narration: none. R2 research: none. R3 evidence naming a change: none. R4 rejected alternatives: none added. R5 PR/issue references: none. R6 open questions: unchanged.

Regression test

PowerSearchBottomSheet.test.tsx — "Done on a field that became read-only while the flow was open reports nothing and closes (FR15b)": fails on main (onChange is called), passes with the fix.

Scope

  • One defect, one cause, one fix (plus the two comment corrections the same review named).
  • Unrelated fixes, cleanup, and policy changes were removed or split.
  • Public text and artifacts contain no internal Meta context.

Testing

  • pnpm exec vitest run packages/core/src/PowerSearch/PowerSearchBottomSheet.test.tsx (187), core typecheck, strict ESLint on packages/core/src/PowerSearch, pnpm check:knowledge, pnpm check:changesets, changeset coverage, Prettier, git diff --check.

…et was open reports nothing

The sheet's draft is dropped when the field is read-only or disabled at
Done, as the Tokenizer sheet does for a disabled field. The onChange prop
and draft-edit comments say what Done reports: the field's latest filters
with each edit applied.
@vercel

vercel Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 4, 2026 8:36am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 4, 2026
@imdreamrunner

Copy link
Copy Markdown
Contributor Author

/approve-spec ce9fadf

@astracat-bot

astracat-bot Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 4, 2026, 8:43 AM UTC

@astracat-bot astracat-bot Bot 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.

Approved pending CI: CI has not finished on this head yet.

Done in the sheet flow now drops the draft when the field became read-only while the flow was open, as the FR15b sentence approved on this head states. The new test fails on main and passes here. Two optional suggestions are inline: a shorter DraftEdit comment, and a Tokenizer FR26 citation that covers only the disabled case.

[Automated review]

// =============================================================================

/** One edit of the draft: the list before it, the list after it, and how it was reported. */
/** One edit of the draft: the draft before and after it, and its type and index in the draft; Done replays it onto the field's latest filters. */

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.

Non-blocking: this is one 27-word sentence with two topics, and its first half repeats the field names (before, after, changeType, index). A shorter comment keeps only the reason:

/** One edit of the draft. Done replays it onto the field's latest filters. */

| FR15 | Confirming a created filter adds it to the draft (FR15b), recorded as `('add', draft.length)` with the list after it; choosing a field whose only operator takes an `empty` value adds that filter the same way from the Add filter row, with no value step. Tapping an editable Filters row opens the value step on that filter in edit mode; Apply writes the edited filter into the draft at its index, recorded as `('edit', index)`; the row's trailing remove action, or a tap on an `empty`-valued filter's row, removes it from the draft, recorded as `('remove', index)`, where `index` is the filter's position in the draft at that edit. The draft is the flow's own list: a controlled parent's change to `filters` while the flow is open does not reach the open sheets; Done replays the draft's edits onto the field's latest filters (FR15b), and a dismissal leaves the change in place, so it shows on the next open. Every edit shows the Filters sheet as FR15a states. While the field is read-only, or disabled, no edit happens. | DEC-3; DEC-7; touch-flow evidence | Current contract; verified by focused sheet tests. |
| FR15a | The steps stack: each step opens above the sheet that led to it, which stays open — receded and blocked as a covered sheet of the stack (`component:BottomSheet` FR5, FR6) — so the stack is Filters alone; Filters under Add filter; Filters under the value step for an edit; Filters under Add filter under the value step for a creation; or, when Add filter was the entry point, Add filter alone and then Add filter under the value step. No sheet of the flow carries a Back action: a dismissal — Escape, a scrim tap, a swipe, a platform close request — reaches only the top sheet (`component:BottomSheet` FR7), closes it, and reveals the sheet beneath, which takes focus back as FR16 states; dismissing the bottom sheet of the stack closes the flow. Cancel on the value step is that dismissal. A commit closes the step that made it: an edit's commit reveals Filters beneath the value step; a creation's commit, from the value step or from an Add filter row or suggestion that commits directly, closes Add filter, and the value step above it, together and shows Filters, so the person sees the filter just added: Filters is revealed when it is open beneath them; after a direct entry it opens in the same update that closes them — BottomSheet's same-update replace (`component:BottomSheet` FR10) when Add filter alone closes, and the stack's ordinary closes and open (`component:BottomSheet` FR5–FR9) when the value step closes with it. A creating `Editor` override's `onSave(null)` (FR14) shows Filters the same way. The flow therefore has one direction forward (open a step above) and one back (close the top step): no dismissal replaces a step, and Filters opens as other sheets close only when a creation ends after a direct entry. | DEC-3; `component:BottomSheet` FR5–FR9 | Current contract; verified by focused sheet tests and real-engine touch evidence. |
| FR15b | One open flow edits one draft of the filter list, which starts as `filters` when the flow opens. Every add, edit and removal (FR15) and Clear all (FR23, DEC-4) changes the draft, and the rows, the empty state and Clear all follow it; `onChange` is not called. Done applies the draft: it replays the recorded edits, in order, onto the field's latest `filters` — an add appends its filter; an edit replaces the first filter matching the one it edited (by field, operator, value and read-only flag); a removal drops the filters it removed — and calls `onChange` once per edit with the list after it and that edit's `changeType` and the `index` in that list, the calls a popover session makes, so a filter the parent added while the flow was open survives; an edit or removal whose target the parent removed meanwhile is skipped; then the flow closes; a draft that equals the filters at open (same filters, in order, by field, operator, value and read-only flag, whatever the order of a value's keys) reports nothing and closes. Done is in the Filters footer and in Add filter's footer when Add filter is the entry point. The field's result count follows the applied filters, so it changes on Done, not on an edit. | DEC-7 | Current contract; verified by focused sheet tests. |
| FR15b | One open flow edits one draft of the filter list, which starts as `filters` when the flow opens. Every add, edit and removal (FR15) and Clear all (FR23, DEC-4) changes the draft, and the rows, the empty state and Clear all follow it; `onChange` is not called. Done applies the draft: it replays the recorded edits, in order, onto the field's latest `filters` — an add appends its filter; an edit replaces the first filter matching the one it edited (by field, operator, value and read-only flag); a removal drops the filters it removed — and calls `onChange` once per edit with the list after it and that edit's `changeType` and the `index` in that list, the calls a popover session makes, so a filter the parent added while the flow was open survives; an edit or removal whose target the parent removed meanwhile is skipped; then the flow closes; a draft that equals the filters at open (same filters, in order, by field, operator, value and read-only flag, whatever the order of a value's keys) reports nothing and closes, and so does Done on a field that became read-only or disabled while the flow was open (the draft is dropped), as `component:Tokenizer` FR26 states for its sheet. Done is in the Filters footer and in Add filter's footer when Add filter is the entry point. The field's result count follows the applied filters, so it changes on Done, not on an edit. | DEC-7 | Current contract; verified by focused sheet tests. |

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.

Non-blocking: component:Tokenizer FR26 states this only for a disabled field ("A field that is disabled when Save fires reports nothing."), and Tokenizer has no isReadOnly prop. Consider "as component:Tokenizer FR26 states for a disabled field".

@imdreamrunner
imdreamrunner enabled auto-merge (squash) November 4, 2026 08:44
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · ce9fadf

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
PowerSearch · Storybook 236.0 kB (0) · 21.8 kB CSS (0) 7,173 (0) ✓ · ✓ · ✓

Package size: measured; main has no measurement of the merge base to compare yet.

API changes: cli +8 · ~0 · −0 (against the merge base's committed report); theme-butter +1 · ~0 · −0 (against the merge base's committed report); theme-chocolate +1 · ~0 · −0 (against the merge base's committed report); theme-gothic +1 · ~0 · −0 (against the merge base's committed report); theme-matcha +1 · ~0 · −0 (against the merge base's committed report); theme-neutral +1 · ~0 · −0 (against the merge base's committed report); theme-stone +1 · ~0 · −0 (against the merge base's committed report); theme-y2k +1 · ~0 · −0 (against the merge base's committed report)

Committed API report behind this build: cli 8 rows, theme-butter 1 row, theme-chocolate 1 row, theme-gothic 1 row, theme-matcha 1 row, theme-neutral 1 row, theme-stone 1 row, theme-y2k 1 row; run pnpm api:report.

15 API changes (advisory)
Package Where Signature Usage
+ cli ./api · Types · type SearchResultEntry deprecated?: ComponentDeprecation | undefined import type {SearchResultEntry} from '@astryxdesign/cli/api'; const x: SearchResultEntry = {deprecated: …}
+ cli ./authoring · Types · interface ComponentDeprecation interface ComponentDeprecation import type {ComponentDeprecation} from '@astryxdesign/cli/authoring'
+ cli ./authoring · Types · interface MultiComponentDoc deprecated?: ComponentDeprecation import type {MultiComponentDoc} from '@astryxdesign/cli/authoring'; const x: MultiComponentDoc = {deprecated: …}
+ cli ./authoring · Types · interface SingleComponentDoc deprecated?: ComponentDeprecation import type {SingleComponentDoc} from '@astryxdesign/cli/authoring'; const x: SingleComponentDoc = {deprecated: …}
+ cli ./doc · Types · interface ComponentBaseDoc deprecated?: ComponentDeprecation import type {ComponentBaseDoc} from '@astryxdesign/cli/doc'; const x: ComponentBaseDoc = {deprecated: …}
+ cli ./doc · Types · interface SubComponentDoc deprecated?: ComponentDeprecation import type {SubComponentDoc} from '@astryxdesign/cli/doc'; const x: SubComponentDoc = {deprecated: …}
+ cli ./doc · Also exported from an earlier entry point · ComponentDeprecation ComponentDeprecation (./authoring) import {ComponentDeprecation} from '@astryxdesign/cli/doc'
+ cli ./template · Also exported from an earlier entry point · ComponentDeprecation ComponentDeprecation (./authoring) import {ComponentDeprecation} from '@astryxdesign/cli/template'
+ theme-butter Stylesheets · var --duration-exit (./theme.css) var --duration-exit (./theme.css) .my-scope { --duration-exit: …; }
+ theme-chocolate Stylesheets · var --duration-exit (./theme.css) var --duration-exit (./theme.css) .my-scope { --duration-exit: …; }
+ theme-gothic Stylesheets · var --duration-exit (./theme.css) var --duration-exit (./theme.css) .my-scope { --duration-exit: …; }
+ theme-matcha Stylesheets · var --duration-exit (./theme.css) var --duration-exit (./theme.css) .my-scope { --duration-exit: …; }
+ theme-neutral Stylesheets · var --duration-exit (./theme.css) var --duration-exit (./theme.css) .my-scope { --duration-exit: …; }
+ theme-stone Stylesheets · var --duration-exit (./theme.css) var --duration-exit (./theme.css) .my-scope { --duration-exit: …; }
+ theme-y2k Stylesheets · var --duration-exit (./theme.css) var --duration-exit (./theme.css) .my-scope { --duration-exit: …; }

Touched components checked; add ci:run-visual, ci:run-a11y or ci:run-rtl to run the full suites.


Generated by PR Enrichment workflow | View full report

@imdreamrunner
imdreamrunner merged commit cc034ed into main Nov 4, 2026
61 checks passed
@github-actions
github-actions Bot deleted the fix/powersearch-sheet-done-read-only branch November 5, 2026 06:03

This branch was successfully deployed

1 active deployment
Preview — ce9fadf1 Deployed Nov 4, 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant