-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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: qwik-table adapter #5420
Feat: qwik-table adapter #5420
Conversation
Looks good, will probably test this out tomorrow! |
Cool, In the meantime I'll be testing and adding more examples as soon as I find free time. |
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 83c159b. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 2 targetsSent with 💌 from NxCloud. |
@anxhirr I worked a bit on this PR. I think it might be in a better place now. All tests passing. Build output looks fine. What's the dummy state in the adapter for though? |
On the first version, I was getting some serialization error if I did not provide it. EDIT: I just double-checked and yes there is still an error if pageSize, pageIndex, left or right is not provided in the columnPinning and pagination state. |
@anxhirr I'm fixing the filters example. Also, you should be able to use |
@anxhirr Take a look at my adapter changes. I made it mostly mirror the react-table adapter. I don't know much about Qwik stores vs signals vs whatever, or why React on Left. Qwik on Right: |
…able state store with signal
@KevinVandy I made some other small changes, feel free to look. I switched Also, |
@KevinVandy And oh, for some reason |
@anxhirr This is looking solid, (I mean qwik), pardon the pun. If we're confident that these are best practices, we just need to do some documentation setup. There's some small amount of work to do in the "docs" folder in this repo that I'll do quick. I also have an open PR for TanStack.com that I'll get one of the other maintainers to merge for me soon. TanStack/tanstack.com#196 |
@anxhirr This can be a future PR after this one, but would you be interested in forking the "React Table State" docs for what is needed for Qwik? https://tanstack.com/table/latest/docs/framework/react/guide/table-state Probably as simple as replacing |
@anxhirr What is this error in each of the examples? main.tsx:202 QWIK ERROR One of the children of is not an accepted value. JSX children must be either: string, boolean, number, , Array, undefined/null, or a Promise/Signal. Instead, it's a function named "header". |
Just checked, and fixed, very strange tho why it did not appear on my side before I did the commit |
@KevinVandy For sure I can help with docs. This weekend I might have plenty of free time |
@anxhirr I'm actually not sure if state should be in a I'm guessing the only difference is that This can, of course, change later if needed. |
Hi, Yeah I'm not a Qwik expert either but changing it in the future based on needs would not be a breaking change I think. I see this was merged. Do I need to change/add any docs or you handled it all by yourself? |
Any holes in the docs, especially more examples, are welcome to PRs always. |
Hello! Trying this out in a hobby project. First of all - thank you for contributing the adapter. Looks like I'm running into a crash in dev mode. Looks like it's related to the use of useSignal / useStore inside this hook. I'm new to Qwik myself so not sure if that's accurate - just going by the error message.
|
Create an issue with a sandbox reproducing this error? |
#5455 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I heard there were issues with this integration and vite but I can't see anything that would cause that. In any case, some comments
@@ -0,0 +1,72 @@ | |||
import * as Qwik from '@builder.io/qwik' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this work with tree shaking? Wouldn't it be better to import only what's used?
typeof comp === 'function' | ||
|
||
const isQwikComponent = (comp: unknown): comp is QwikComps => | ||
isFunction(comp) && comp.name === 'QwikComponent' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This definitely can't be relied on to always work. If there's no such function exported you can open an issue to request one.
Furthermore this doesn't work with inline components, which are just functions.
const table = Qwik.useStore<{ | ||
instance: Qwik.NoSerialize<Table<TData>> | ||
}>({ | ||
instance: Qwik.noSerialize(createTable(resolvedOptions)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be inside a function. Every time this runs it creates an instance which gets ignored
}) | ||
|
||
// By default, manage table state here using the table's initial state | ||
const state = Qwik.useSignal(table.instance!.initialState) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why copy the state to a signal? It's already a store
}, | ||
// Similarly, we'll maintain both our internal state and any user-provided | ||
// state. | ||
onStateChange: updater => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Every time this hook runs it will change this callback. Better to only set it once, no?
@KevinVandy not sure if you saw my comments above |
@wmertens we'd love help remaking the quick adapter the right way. Especially for v9 in the alpha branch. |
Hi TanStack team,
I've created a qwik-table adapter designed to integrate the table core with the Qwik framework. I have tested(not fully) and created examples for column sorting, pagination, and row selection.
I thought it was a good idea to share this as a first version and get some thoughts on whether this looks promising or not.
I welcome any feedback and look forward to contributing/helping make the adapter as perfect as the core itself is xD.
This discussion is related: #5281