TanStack / table

🤖 Headless UI for building powerful tables & datagrids for TS/JS - React-Table, Vue-Table, Solid-Table, Svelte-Table
https://tanstack.com/table
MIT License
24.51k stars 3.03k forks source link

ensure columnPinning.[property] is not accessed unsafely #5519

Open rustysys-dev opened 2 months ago

rustysys-dev commented 2 months ago

Had issues with the qwik examples etc... things just didn't really work at all, and it seems like unnecessary processing is being done in the lib..

In anycase, I decided to build my own table using the core lib directly for qwik.. however I am running into a bug, where if you provide an empty state to start off with the entire app crashes on trying to read the left property on columnPinning as shown:

image

I notice that most (not all) other functions in the code which do something similar are not accessing it safely with columnPinning?.[property]

KevinVandy commented 2 months ago

Maybe it would make more sense for us to make sure all of the typescript types enforce the full object is always present?

rustysys-dev commented 1 month ago

@KevinVandy I think that would satisfy the requirement as well, but I suppose I should ask, is column pinning really required to be defined? If it must be defined for other features etc to work then enforcement via typescript is definitely best.

If not then a thought in the back of the head is that it would cause unnecessary development required when using the core lib.

KevinVandy commented 1 month ago

@KevinVandy I think that would satisfy the requirement as well, but I suppose I should ask, is column pinning really required to be defined? If it must be defined for other features etc to work then enforcement via typescript is definitely best.

If not then a thought in the back of the head is that it would cause unnecessary development required when using the core lib.

Yes, it is assumed that all of the getInitialState calls for each feature have been called successfully.