Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor TableModule with TanStack Table #331

Open
6 tasks done
shawnzhu opened this issue Mar 20, 2023 · 2 comments
Open
6 tasks done

Refactor TableModule with TanStack Table #331

shawnzhu opened this issue Mar 20, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@shawnzhu
Copy link
Member

shawnzhu commented Mar 20, 2023

Checkout TanStack Table.

This is a follow up of #330 to cover:

  • adding react-table as implementation and make it backward compatible.
  • when using config of TableModule, no changes to existing apps that use it.
  • when using columns: ColumnRef[] to configure TableModule , it will use react-table 's implementation.

Tasks

  • rendering - adapt stanstack table API
  • row selection
  • sort by column
  • sticky column
  • row actions
  • row click
@shawnzhu shawnzhu added the enhancement New feature or request label Mar 20, 2023
@shawnzhu shawnzhu self-assigned this Mar 20, 2023
@shawnzhu
Copy link
Member Author

shawnzhu commented Mar 21, 2023

I spent hours trying to conquer the sorting feature then realized that the sorting in TableModule is a very special API coupling with custom types and a single hard coded hook (sort). I tried to adapt it with the TanStack table API but it will be LOTS of work.

Action: I will use the feature toggle route to add TanStack API as optional path of TableModule the deprecate the existing implementation over time.

Sorting in TableModule

In TanStack table terms, it uses manual sorting, which means user must provide sorting functions, sorted data and header click handler. the solution is using a config.header.onSort(props: TableSortClickProps) and hard coded hook sort.

Sorting in TanStack react-table

it supports both sorting feature like default sorting functions + state management sortingState at table API and manual sorting via manualSorting and onSortingChange.

So if we want the TanStack table API, it needs to deprecate the existing sorting API.

@shawnzhu
Copy link
Member Author

#333 is a temporary solution before fully adopt TanStack table API

shawnzhu added a commit that referenced this issue Mar 28, 2023
fix(PHC-4380): achieves backward compatibility #331
@shawnzhu shawnzhu removed their assignment Oct 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant