You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using useState(), adding or removing rows does not properly update TableView to adjust its height.
More apparant with dark-mode.
🤔 Expected Behavior
When adding or removing a row to/from TableBody, TableView should automatically adjust its height (if no height was set) to match its content.
😯 Current Behavior
When adding or removing a row, TableView does NOT increase its height. It keeps its height and adds a scrollbar. (see image)
Please note: In my example I have NOT set the height property.
When removing a child, TableView doe NOT decrease its height, but keeps the current height and removes a row. (see image)
When reloading the page with an increased amount of rows, the TableView DOES render properly with an adjusted height.
When reloading the page with a decreased amount of rows, the TableView DOES render properly with an adjusted height.
💁 Temporary Solution
Using Array.toString() for the key-property of TableView does re-render the component properly. Using Array.length for the key-property of TableView does re-render the component properly. All of that, of course, is really hacky.
🔦 Context
I am trying to create a panel in which an admin can use buttons to create, delete and edit users. When doing so, I make a call to my server to fetch users and refresh my useState of the current available users. To trigger useState's re-render I spread my array to create a new reference: setAccounts([...data]);
💻 Code Sample
Here is a stackblitz application to show you the problem: Code(View App.tsx) Demo
Note: Please emulate dark-mode to make the problem more apparent
Note: In this stackblitz example, adding rows doesn't seem to be a problem. In my project, adding rows does not work, (code below)
This is my code where I noticed the problem. The problem is even more apparent on here because stackblitz seems to be able to increase the component height.
🐛 Bug Report
When using
useState()
, adding or removing rows does not properly update TableView to adjust its height.More apparant with dark-mode.
🤔 Expected Behavior
When adding or removing a row to/from TableBody, TableView should automatically adjust its height (if no height was set) to match its content.
😯 Current Behavior
When adding or removing a row, TableView does NOT increase its height. It keeps its height and adds a scrollbar. (see image)
Please note: In my example I have NOT set the height property.
When removing a child, TableView doe NOT decrease its height, but keeps the current height and removes a row. (see image)
When reloading the page with an increased amount of rows, the TableView DOES render properly with an adjusted height.
When reloading the page with a decreased amount of rows, the TableView DOES render properly with an adjusted height.
💁 Temporary Solution
Using
Array.toString()
for the key-property of TableView does re-render the component properly. UsingArray.length
for the key-property of TableView does re-render the component properly. All of that, of course, is really hacky.🔦 Context
I am trying to create a panel in which an admin can use buttons to create, delete and edit users. When doing so, I make a call to my server to fetch users and refresh my useState of the current available users. To trigger useState's re-render I spread my array to create a new reference:
setAccounts([...data]);
💻 Code Sample
Here is a stackblitz application to show you the problem:
Code (View App.tsx)
Demo
Note: Please emulate dark-mode to make the problem more apparent
Note: In this stackblitz example, adding rows doesn't seem to be a problem. In my project, adding rows does not work, (code below)
This is my code where I noticed the problem. The problem is even more apparent on here because stackblitz seems to be able to increase the component height.
🌍 Your Environment
The text was updated successfully, but these errors were encountered: