Skip to content

Cancel in Manage bindings no longer renames the table - #657

Merged
MerciHanrim merged 1 commit into
mainfrom
manage-bindings-cancel-discards
Nov 24, 2026
Merged

MerciHanrim merged 1 commit into
mainfrom
manage-bindings-cancel-discards

Conversation

@MerciHanrim

Copy link
Copy Markdown
Owner

Part of #615 (item 4 only; items 2 and 1 follow in their own PRs, items 5 and 3 are not in this one).

What was wrong

Data ▸ Refresh or manage imported tables (Manage bindings) saves a table rename when the name field loses the focus. Its only button is Cancel. Measured on main fde07d85 (scratch reproduction, then the tests below on main's code):

Close Table name stored Undo entries On reopening
Typed a name, Cancel the typed name +1 the typed name
Typed a name, Escape unchanged unchanged the typed name shows again
Typed a name, a press outside the dialog unchanged unchanged the typed name shows again
Typed a name, Tab (leaving the field) the typed name +1 the typed name
  • A press on Cancel took the focus from the field first, and that blur saved the draft. So the button that should discard renamed the table, and its auto-composed Parameters, as one Undo entry.
  • Escape and a press outside close without that blur. But the dialog stays mounted while closed (toolbar/DialogHost.tsx:80), so the draft and its error stayed in its state. The next Cancel would save it.

The change (src/components/dataImport/DataImportRefreshMenu.tsx)

  • Cancel's onMouseDown prevents the focus move, so no blur and no save happen before it closes.
  • When the dialog closes, by Cancel, Escape or a press outside, its rename drafts and their errors are discarded. This is done by the usual reset-on-prop-change during render, not an effect.
  • Leaving the field (Tab, or a press elsewhere in the dialog) still saves the rename, as before. That includes reaching Cancel with Tab: the Tab saves, then Cancel closes.

Tests (e2e/data-import-refresh.spec.ts), written first

There is one test per way of closing: Cancel, Escape, and a press outside. Each types a name, closes, and checks three things:

  • the table keeps its name;
  • the Undo stack is unchanged;
  • on reopening the field shows the stored name, and a second Cancel saves nothing.

On main's code all three fail:

  • Cancel renamed the table and added an Undo entry.
  • Escape and the press outside showed the draft again on reopening.

A fourth test, the control, checks that leaving the field with Tab still saves, one Undo entry, and that closing keeps it. It passes before and after.

Checks

  • npx tsc -b: clean.

  • npm run lint: 88 warnings, the baseline.

  • All check:* scripts: pass.

  • Unit suite: 5758 passed, 4 skipped.

  • Related e2e, one worker, no retries:

    • e2e/data-import-refresh.spec.ts: 13 passed;
    • every other spec that opens this dialog (csv-download-encoding, data-import-refresh-errors, error-paths-423, rtl-bidi-isolation): 36 passed.

    None holds a screenshot comparison.

What it touches

  • Only how Manage bindings closes.
  • A rename is still saved by leaving the field.
  • The Refresh button and the CSV export are unchanged.

A press on Cancel no longer takes the focus from the name field first, so the blur that saves a rename does not run; closing the dialog by Cancel, Escape or a press outside discards the drafts and their errors. Leaving the field still saves. Part of #615.
@MerciHanrim MerciHanrim added the bug Something isn't working label Nov 24, 2026
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying cozy-loop-studio with  Cloudflare Pages  Cloudflare Pages

Latest commit: 03134ef
Status: ✅  Deploy successful!
Preview URL: https://2f48616e.cozy-loop-studio.pages.dev
Branch Preview URL: https://manage-bindings-cancel-disca.cozy-loop-studio.pages.dev

View logs

@MerciHanrim
MerciHanrim merged commit b17aa72 into main Nov 24, 2026
23 of 25 checks passed
@MerciHanrim
MerciHanrim deleted the manage-bindings-cancel-discards branch November 24, 2026 03:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant