Table resetting when adding rows dynamically
Hi,
My table is resizable and I'm trying to add input rows through an onClick function using state/React, but when I do, the resized table shifts back to default size, presumably because it's rerendering when the state changes. Any advice?
Figured out we have a very similar problem. We render a table with multiple inputs for rows which values are managed by onChange linked to the component's state that wraps React Table. After upgrading from 6.8.6 to 6.9.2, the behaviour of these inputs changed:
Before (6,8.6): able to write text in input fields continuously, with no interruption, having a relevant value held in the state.
After (6.9.2): on each change i.e. new character entered into the input field, the table gets reloaded with losing a focus.
A simple code snippet to reproduce: https://codesandbox.io/s/ywqko2x0r1 -- try writing something to the input field e.g. by pressing & holding the button.
One of the wild guesses is, the cells are being re-rendered with new keys, so React loses an element previously used for input. We'll investigate further if we can, but for now, had to roll back to 6.8.6.
If you have questions about support or implementation, please use the React Table Spectrum Community
Having the same
Figured out we have a very similar problem. We render a table with multiple inputs for rows which values are managed by
onChangelinked to the component's state that wraps React Table. After upgrading from 6.8.6 to 6.9.2, the behaviour of these inputs changed:Before (6,8.6): able to write text in input fields continuously, with no interruption, having a relevant value held in the state.
After (6.9.2): on each change i.e. new character entered into the input field, the table gets reloaded with losing a focus.
A simple code snippet to reproduce: https://codesandbox.io/s/ywqko2x0r1 -- try writing something to the input field e.g. by pressing & holding the button.
One of the wild guesses is, the cells are being re-rendered with new keys, so React loses an element previously used for input. We'll investigate further if we can, but for now, had to roll back to 6.8.6.
Exact same issue. Resolved by using 6.8.6
Also having the same problem re: the table re-rendering when I have an input as a table cell. Confirmed 6.8.6 seems to resolve the issue.
@tannerlinsley i'm not familiar with Spectrum but it seems weird to need to use a chat client to discuss a bug report, maybe you misunderstood the issue? Or maybe we should make a new issue here on GH to discuss the problem discussed after the OP, where the table seems to re-render when an input in a table cell is typed into?