Skip to content
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

onCellsChange doesn't re-render changed cells #277

Open
maejoh opened this issue Apr 10, 2021 · 1 comment
Open

onCellsChange doesn't re-render changed cells #277

maejoh opened this issue Apr 10, 2021 · 1 comment
Assignees
Labels

Comments

@maejoh
Copy link

maejoh commented Apr 10, 2021

If a cell is changed, and then a different cell is selected (not from pressing enter, but from mouseDown on a different cell), the changed cell re-renders before onCellsChanged is called, so the underlying data is changed, but the visible cell renders the old value. The new value is only reflected to the user when the cell is selected again.

Similarly, if changing one cell makes changes to other cells that aren't currently selected, the underlying data structures are changed, but the values aren't reflected in the secondary cells until they are selected (which makes the values re-render).

@maejoh
Copy link
Author

maejoh commented Apr 12, 2021

You can work around this by creating an additional state variable and setting it when you need the whole sheet to re-render, but this causes all cells to re-render, not just the changed cells, which isn't optimal. Also I'm not entirely sure why it works, as it only works for me when the variable is an array of the changed cells indices, and not when it's something like a simple boolean, even though my code never reads from that list of indices.

@nadbm nadbm self-assigned this Apr 12, 2021
@nadbm nadbm added the bug label Apr 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants