Skip to content

fix(data): stop forcing every new table to kind 'data'#216

Open
hrq-chiuchi wants to merge 1 commit into
CoreBunch:mainfrom
hrq-chiuchi:fix/data-table-kind-forced-to-data
Open

fix(data): stop forcing every new table to kind 'data'#216
hrq-chiuchi wants to merge 1 commit into
CoreBunch:mainfrom
hrq-chiuchi:fix/data-table-kind-forced-to-data

Conversation

@hrq-chiuchi

Copy link
Copy Markdown

Summary

  • createTable in src/admin/pages/data/hooks/useDataWorkspace.ts unconditionally spread { ...input, kind: 'data' } into createCmsDataTable, overriding whatever kind the New Table dialog actually sent.
  • Result: choosing "Post type" in the New Table dialog silently created a plain data table instead — no title/slug/body fields, no routing, and (per TableSettings.tsx) table kind can't be changed after creation, so the only fix is deleting and recreating the table.
  • Found while building custom post-type collections for a real site — reproduced by selecting "Post type" in the dialog and inspecting the resulting row's kind column.

Fix

Pass input straight through instead of overriding kind. The server (server/handlers/cms/data/tables.ts) already validates body.kind correctly, so no other changes needed.

Test plan

  • bunx tsc -b --noEmit passes
  • bun test passes (no existing coverage for this path — none broken)
  • Manually verified: creating a table with Kind = "Post type" now persists kind: 'postType', gets title/slug/body/featuredMedia/seoTitle/seoDescription fields, and an auto-set /<slug> route base

createTable in useDataWorkspace hard-coded kind: 'data' on every
createCmsDataTable call, silently discarding the Kind selection made in
NewTableDialog. Choosing "Post type" in the dialog always produced a
plain data table with no title/slug/body/routing.

Pass the dialog's input straight through instead of overriding it.
@hrq-chiuchi hrq-chiuchi marked this pull request as ready for review July 12, 2026 01:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant