-
Notifications
You must be signed in to change notification settings - Fork 617
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
feat(Table)!: allow passing all tanstack options as root props #3177
base: v3
Are you sure you want to change the base?
Conversation
commit: |
6921dc1
to
d8e4cfd
Compare
Hey @sandros94. I've tried both Dev Drive and WSL as you suggested and the same issue persists. Can you please take a look and share any ideas you have? The errors happens when I extend the props with // This Works
export interface TableProps<T> {
tanstackOptions: TableTanstackOptions<T>,
}
// This errors
export interface TableProps<T> extends TableTanstackOptions<T> { |
After some digging, probably it's not supported yet vuejs/core#8482 |
I still think that this is completely unrelated to path length or anything on that topic. I see this as two different issues, one related to types (the requirement of Will update in a few minutes (famous last words) |
but if this was it (as Vue needs to compile the types, so they cannot be fully dynamic) why it works when dynamic types are passed to as |
Indeed the issue seems to be related to I found a potential fix, but before pushing it I want to double check it further |
The problem is the intersection/union of To confirm it further I tried extending the most basic type and I also got the same error. export interface TableProps<T> extends { foo: 'bar' } |
@MuhammadM1998 not really, take a look at 20307f4. As you can see some of the Now I'm experimenting with the base options for those features that I currently commented out, as I suspect that the issue is more related to their functions. I've also removed |
Hmm I might be missing something I don't get why Another thing I noticed is you moved the table props to |
Yes indeed, and I'm probably going to revert it. The reason why I did move it is because it could easily break the various emits. |
I get what you mean now. I'll try to test it and see if I catch anything. Thanks for the help π |
I'm always happy to help where I can π¬ Personally, I'm still not fully convinced about having all the tanstack options as top-level props. I had to rely on @MuhammadM1998 let me know if you notice anything. In my limited experience with tanstack it does seem to work correctly now (although some types are missing due to the requirement of vue ignore mentioned). @benjamincanac Are we sure that the DX we want to achieve is completely encapsulated within a single component? What about creating a wrapper composable for Also, any particular reason why: ui/src/runtime/components/Table.vue Lines 201 to 203 in f21e923
defineExpose(tableApi) ? This way we could simplify the DX by providing table?.setPageIndex(p - 1) instead of table?.tableApi.setPageIndex(p - 1) (if we want to keep everything in a single component, without a dedicated composable)
|
Trying to catch-up here, is this ready for review? π€ @sandros94 This is how components are made in Nuxt UI v3, if you want a component for |
@sandros94 In my last commit, I've cleaned a bit and moved the |
Or Reka UI, but yes out scope of Nuxt UI
Technically speaking, yes. What doesn't fully convince me is that quite a few What I left untouched are all the |
Rethinking about this it shouldn't be a problem. Basically, talking out loud, the DX would become like:
@benjamincanac WDYT? |
π Linked issue
#2441
β Type of change
π Description
As discussed in #3065, This PR allows the user to pass all accepted options to
useVueTable
. This has caveats discussed below, until then I'll leave it in draft.This PR implements these points:
tanstackOptions
prop that accepts all the possibleuseVueTable
options. This means the user can implement any Tanstack feature without waiting on the library to implement it.tanstackOptions
prop to allow the user to override them if needed.getPaginationRowModel
as a default to have pagination baked-in similar to sorting and the other common features we have as defaults.Caveats:
This has 2 problems that needs to be addressed.
tanstackOptions
is a breaking change.sorting
model value but pass options to thetanstack-options
prop. which is not ideal.I've tried doing the following to extend the Tanstack options as top-level props which would solve both of the above problems.
But the playground & docs crashes with the following error similar to the one mentioned in #2291
When I use
/* @vue-ignore */
the app works correctly but then the top level options are passed asattrs
notprops
as mentioned in the error instruction, so no way to extract them and pass themuseVueTable
.π Checklist