Skip to content

The data wizards' Header row and Ignore last N rows take a number on Enter or on leaving the field - #660

Merged
MerciHanrim merged 2 commits into
mainfrom
import-row-fields-confirm
Nov 24, 2026
Merged

MerciHanrim merged 2 commits into
mainfrom
import-row-fields-confirm

Conversation

@MerciHanrim

@MerciHanrim MerciHanrim commented Nov 24, 2026 •

Copy link
Copy Markdown
Owner

Part of #615 (item 1's two wizards' header-row fields; with #659's trigger delay, this completes item 1).

What was wrong

Measured on main 0564cda0, keys typed one at a time:

Import wizard Refresh wizard
Header row 2, Backspace the field shows 1 1
then 3 13 13
the column roles set (key / label / number) lost: [ignored], [], then [ignored × 3] back at row 2 none on that step

Both wizards passed every change of "Header row" and "Ignore last N rows" through sanitizeRowCount, so a blank became the minimum at once. The import wizard also reparsed the paste on each change. A reparse resets the roles whenever the header row's cell count differs, and on the way the row passed through the one-cell note line.

The change

In both wizards, both fields use DraftNumberInput with commitOnConfirm, as Seed, Runs and Steps do. The value is set on Enter or on leaving the field:

  • only a whole number is taken: ≥ 1 for the header row, ≥ 0 for "Ignore last N rows";
  • a blank or anything else confirms nothing and puts the last value back;
  • no key on the way reparses.

The rule that a confirmed header row with another cell count resets the import roles is unchanged.

sanitizeRowCount is removed from both files; nothing uses it now.

Kept out, by agreement: the refresh wizard's Column changes choices reset by Back → Next. They reset even without touching the header row. It is listed in #615's follow-up scope.

Tests

e2e/import-row-fields.spec.ts (new, written first; run on main's code first):

Test On main's code With the change
Import wizard: header row 2, roles set; Backspace leaves the field blank (not 1) and the roles as set; 3 shows 3 (not 13), roles as set; select all + 2 + Enter: still 2, roles kept fails passes
Control: header row 1 (another cell count) by Enter resets the roles to [ignored]; header row 2 by leaving the field (Tab) resets them to [ignored × 3] passes passes
Import wizard, "Ignore last N rows": Backspace leaves it blank (not 0); 1 + Enter sets 1; a blank confirmed by Tab shows 1 again fails passes
Refresh wizard (strengthened in the second commit, at Lumi's review) fails passes

The refresh wizard test checks:

  • header row 2, Backspace, 3: the field never shows 1 or 13;
  • Enter sets 2, and row 2 is read as the header. Its columns match the stored table, so Next goes straight to the review ("Commit refresh"). Row 1, the note line, would have stopped at Column changes;
  • "Ignore last N rows" is not snapped to 0 while typing;
  • 1 + Enter is set, and a blank confirmed by Tab brings 1 back;
  • with 1, the review says "1 row is missing from the new data" (the last row, itm_b, is ignored);
  • Back, 0 + Tab: the review has no missing row, and the header row is still 2.

On main's two wizard files (checked out temporarily, then restored from the branch head) this test fails three ways: the snapped field, the snapped 0, and the blank not bringing 1 back.

e2e/data-import-wizard.spec.ts:137 filled the header row and picked a role straight away, relying on the per-key update. It now presses Enter after filling, as a person sets the field.

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/import-row-fields.spec.ts: 4 passed;
    • e2e/data-import-wizard.spec.ts: 22 passed;
    • data-import-refresh, data-import-refresh-errors, data-import-wizard-state and data-import-guide: passed in the run with all five data-import specs (66 passed, before the one wizard test was adapted).
  • Snapshots: data-import-guide's 2 screenshot comparisons were compared and passed.

Local note

The first local e2e runs did not start. Vite re-optimised its dependencies ("vite config has changed"), and the first page request took about 48 s to answer, past Playwright's 60 s server wait including the start. No test ran in those attempts. Once the dependency cache was rebuilt, the runs above went normally. It came back after the first commit (the first request then took 89 s), and was handled the same way: the dev server was started once and left to answer before the run. This affects nothing in the PR.

What it touches

  • The two fields in the two wizards.
  • What a confirmed value does is unchanged: the parse, the role rule and the refresh's column matching.

…Enter or on leaving the field

Both wizards use DraftNumberInput with commitOnConfirm (a whole number >= 1, or >= 0 for Ignore last N rows): a blank no longer snaps to the minimum and no key on the way reparses the paste. A confirmed header row with another cell count still resets the import roles. Part of #615.
@MerciHanrim MerciHanrim added the bug Something isn't working label Nov 24, 2026
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Deploying cozy-loop-studio with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3d86d4b
Status: ✅  Deploy successful!
Preview URL: https://444bd4d9.cozy-loop-studio.pages.dev
Branch Preview URL: https://import-row-fields-confirm.cozy-loop-studio.pages.dev

View logs

Header row 2 confirmed is read as the header (Next goes straight to the review, not to Column changes); Ignore last N rows applies by Enter and by Tab (1 row missing from the new data, then none) and a blank confirmed brings the value back. Part of #615.
@MerciHanrim
MerciHanrim merged commit 64c1fea into main Nov 24, 2026
13 checks passed
@MerciHanrim
MerciHanrim deleted the import-row-fields-confirm branch November 24, 2026 09:01
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