Skip to content

Removing a table in the import wizard no longer moves its problems onto another table - #661

Merged
MerciHanrim merged 1 commit into
mainfrom
import-card-errors-by-table
Nov 24, 2026
Merged

MerciHanrim merged 1 commit into
mainfrom
import-card-errors-by-table

Conversation

@MerciHanrim

Copy link
Copy Markdown
Owner

Part of #615 (item 5, part A: the import wizard's table cards; part B, the timetable dialog's file read, follows in its own PR. #615's item 5 is checked when both are merged).

What was wrong

In Data ▸ Import spreadsheet values as Parameters, the problems Next finds are listed under each table card until the next check. The cards were keyed by position (key={ti}), and the problems were matched to a card by their tableIndex, a position in the order the check saw the tables. Measured on main 64c1fea1 (scratch reproduction):

Case After the removal (before the next check)
A1: problem in card 2, card 1 removed the card with the problem (now card 1) shows none
A2: problem in card 1, card 1 removed the clean card left shows the removed card's problem with its own name: "Table Beta, row 3, column 1 (item_key): Key "itm_a" is already used by another row." Its jump leads into the clean card
A3 (control): problem in card 1, card 2 removed correct

This was display only. The lines are greyed and the summary says "The input changed since the last check — press Next to check again", and Next checks the current tables.

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

  • At each check, the tables' ids (sourceTableId) are recorded in the order the check saw them.
  • Each recorded problem is placed by its table's id. A removed table's problems are dropped, and the others follow their table to its card now. The error text, the cell highlight and the jump read the renumbered problems, so they all point at the right card.
  • Cards are keyed by sourceTableId.

validateDrafts, the check and the import are unchanged.

Tests (e2e/import-card-errors.spec.ts, new, written first)

Test On main's code With the change
A1: card 2's problem stays on it when card 1 is removed (its line names Beta (dup)); Next finds it again and stays on the tables fails passes
A2: the clean card left shows no problem and no line names it; Next moves on to placement fails passes
Control: removing the card after the one with a problem moves nothing; Next finds it again passes passes

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-card-errors.spec.ts: 3 passed;
    • data-import-wizard, data-import-wizard-state, data-import-guide, import-row-fields and data-import-refresh: 65 passed.
  • Snapshots: data-import-guide's 2 screenshot comparisons were compared and passed.

What it touches

  • Only where the import wizard shows its recorded problems after a card is removed, and the cards' React keys.
  • The check, the import and the refresh wizard are unchanged.

…to another table

The wizard records the tables' ids in the order its check saw them and places each recorded problem by its table's id: a removed table's problems are dropped, and the others follow their table to its card. Cards are keyed by the table's id. The check and the import are unchanged. 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: ac42091
Status: ✅  Deploy successful!
Preview URL: https://950bf585.cozy-loop-studio.pages.dev
Branch Preview URL: https://import-card-errors-by-table.cozy-loop-studio.pages.dev

View logs

@MerciHanrim
MerciHanrim merged commit b5c69c5 into main Nov 24, 2026
13 checks passed
@MerciHanrim
MerciHanrim deleted the import-card-errors-by-table branch November 24, 2026 11:35
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