-
-
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
Solid Table: Examples from docs cause unnecessary rerenders of components when data updates #5019
Comments
Your description of the bug sounds awfully similar to what I reported for Svelte in #4962. |
Hi @sledgehammer999 - I'm not sure what the fix is, but I think the cause is that flexRender recreates the components. Libraries with VDOM like React do that all the time anyways, but the VDOM buffers the actual DOM updates, so it's not super expensive, whereas Svelte & Solid write to the DOM when a component is created, so it's a lot more costly. |
I thought that, Svelte at least, was able to tell exactly which values/components had changed and update only those elements directly. AFAICT, flexRender() for Svelte just returns a JS class(not an instance) which is a subclass/derived class of SvelteComponent. I could be wrong though. In any case, sorry for hijacking your thread. You don't have to reply to this comment. |
I iterated on your example and got everything working (including row selection and column ordering) with https://stackblitz.com/github/AlexErrant/solid-table-rendering-example Notice how the table more granularly rerenders. The Solid docs state:
You can also use const [data, setData] = createStore(initialData);
const table = createSolidTable({
get data() {
return [...data];
}, To be clear: this is not 100% optimal, per Table's docs:
But at least my solution updates the UI without re-rendering the entire table. (I'm confused because there are zero occurrences of I believe that |
Describe the bug
When implementing a table as shown in the examples in the documentation site, a change to the underlying data causes every row and cell in the table to rerender (instead of updating in a fine grained manner). This is noticeably slow in a real world use case where table edits are supposed to navigate to the next row.
I've noticed that if I use Key instead of For elements, the rows don't rerender, but the cells still do. Only replacing flexRender with a manual <Switch / Match > implementation prevents the cells from rerendering. This however breaks other features, such as row selection & column ordering.
In the screenshot you can see the output of changing first name of a row in each case.
Your minimal, reproducible example
https://codesandbox.io/p/github/raymondboswel/solid-table-rendering-example
Steps to reproduce
Expected behavior
As a user I expect fine grained updates in the table, in order to have decent table performance.
How often does this bug happen?
Every time
Screenshots or Videos
Platform
Chrome / Linux
react-table version
8.9.3
TypeScript version
No response
Additional context
No response
Terms & Code of Conduct
The text was updated successfully, but these errors were encountered: