Repository navigation
Render the actual component for svelte when returned from cell function - #4588
Conversation
|
Would this be a breaking change? |
|
I'd like to see this merged. It's rather a bugfix than a breaking change. Here's a usecase of mine: Without the fix, the EmailColumn component won't receive any props. With the fix applied, the EmailColumn component will receive all props from getContext(). The only current workaround is to use the component itself as the value of cell: But this will a) cause a Typescript error and b) disable the possibility to switch components based on values passed to the cell function. |
|
This does seem to me like a major problem. I am currently investigating for a headless Svelte table after been relatively disappointed by Svelte Headless Table (instabilities, ), but that issue is a deal breaker. |
|
Taking @vd-aloker 's word for it |
|
This PR seems to be causing some issues in #4778 . Do the examples just need to be updated? @itssumitrai @vd-aloker @bfovez Otherwise this PR may need to be reverted. |
|
This completely broke TypeScript in Svelte. Please revert this. |
|
I was trying to understand why this PR is needed. This is how I rendered components before this PR and how I still continue to do so. However, this PR caused a type issue that requires a workaround. I'm just wondering, what did we gain in return? What am I missing? import { renderComponent } from '@tanstack/svelte-table';
const columns = [
display({
id: 'mail',
cell: () => renderComponent(EmailColumn), // without props
cell: () => renderComponent(EmailColumn, { myprop: 'foo' }), // with props (type-safe)
}),
]; |
|
I've just been waiting for someone to make a PR to fix it correctly. If it is as simple as reverting this, we can. |
Currently the flexRender function checks if the result of
cellfunction is a Svelte component, and if it is, it just returns the actual Component instead of rendering the component with the props. This PR fixes this issue