Skip to content

Migrate the shared table to TanStack Table - #35

Merged
fyui001 merged 2 commits into
NewWorldOrg:masterfrom
fyui001:design/data-table-tanstack
Jul 10, 2026
Merged

fyui001 merged 2 commits into
NewWorldOrg:masterfrom
fyui001:design/data-table-tanstack

Conversation

@fyui001

@fyui001 fyui001 commented Jul 10, 2026

Copy link
Copy Markdown
Member

Summary

  • Rewrite the shared DataTable on @tanstack/react-table v8 with a columns/data API (useReactTable + flexRender, manualPagination)
  • Keep PaginatedTable as the card + pagination wrapper; its external pagination props are unchanged, so page components need no changes
  • Column meta carries minWidthPx/sticky hints (module augmentation in types/reactTable.d.ts); internal scroll is an opt-in scrollAreaClassName forwarded to the table container (Table gains an additive containerClassName prop)
  • Clickable rows use role="button" with keyboard support and guard against interactive descendants (links, buttons, inputs)
  • Drop the striped rows and the colgroup width handling; uniform rows with hover highlight
  • Convert the drug list, medication history, and dashboard recent-history tables to ColumnDef; cell rendering (note icon, link cells, hyphen fallbacks) is preserved

Behavior notes

  • Visual change: striped rows are gone (uniform background + hover)
  • DashboardPage consumed the old table API directly, so its recent-history table moved to the new API (max-h-[500px] scroll preserved via scrollAreaClassName)

Verification

  • typecheck / lint / build green (one pre-existing-category warning: react-hooks/incompatible-library on useReactTable, non-failing)
  • Storybook: new DataTable stories (Default / Empty / Loading / ClickableWithLink) plus existing table and page stories verified with Playwright screenshots in light and dark

Rewrite the shared DataTable on @tanstack/react-table v8 with a
columns/data API, keeping PaginatedTable as the card and pagination
wrapper. Column meta carries minWidthPx and sticky hints, the scroll
area is an opt-in scrollAreaClassName forwarded to the table container,
and clickable rows guard against interactive descendants. Drop the
striped rows and the colgroup width handling, and convert the drug,
medication history, and dashboard tables to column defs.
@fyui001 fyui001 self-assigned this Jul 10, 2026
Apply the same interactive-descendant guard to Enter and Space that
row clicks already use, so activating an in-cell link with the keyboard
no longer also triggers the row navigation.
@fyui001
fyui001 merged commit 7f9203b into NewWorldOrg:master Jul 10, 2026
2 checks passed
@fyui001
fyui001 deleted the design/data-table-tanstack branch July 10, 2026 04:45
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