feat: send nothing to TypeSafe when an import's header row holds an address, date or number, skip placeholder Column N headers, accept only the options each column was offered, never infer Subscribed, Categories or Email, prefer an exact existing field name before a folded match on the server as the client does, compute value kinds once per preview, and make Enter in the empty field search a no-op

This commit is contained in:
Matthew Meszaros
2026-09-22 21:29:22 -07:00
parent c1acded32c
commit 7813d77efc
8 changed files with 204 additions and 132 deletions
@@ -800,8 +800,14 @@ export function TargetPicker({
onChange({ index: value.index, target: "custom", custom_key: name });
}
// Enter takes an exact name first, then the first match; with nothing
// typed it does nothing, so it can never remap a column by accident.
function pickFirst() {
if (standard.length > 0) pickStandard(standard[0].id);
if (q === "") return;
const exactStd = standard.find((t) => t.label.toLowerCase() === q.toLowerCase());
if (exactStd) pickStandard(exactStd.id);
else if (existingKeys.includes(q)) pickExisting(q);
else if (standard.length > 0) pickStandard(standard[0].id);
else if (custom.length > 0) pickExisting(custom[0]);
else if (canCreate) pickNew(q);
else return;
@@ -96,6 +96,7 @@ describe("existing custom fields", () => {
it("folds the way the server does", () => {
expect(foldCustomKey(" Company.URL ")).toBe("companyurl");
expect(foldCustomKey("Revenue ($)")).toBe("revenue");
expect(foldCustomKey("Area m²")).toBe("aream²");
});
it("reads both spellings of a custom mapping", () => {