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

Data does not refresh when using editDisplayMode: 'table' #1081

Open
1 task done
Akatroj opened this issue Apr 5, 2024 · 1 comment
Open
1 task done

Data does not refresh when using editDisplayMode: 'table' #1081

Akatroj opened this issue Apr 5, 2024 · 1 comment

Comments

@Akatroj
Copy link

Akatroj commented Apr 5, 2024

material-react-table version

2.12.1

react & react-dom versions

18.2.0

Describe the bug and the steps to reproduce it

I created a table where one column is editable (using editDisplayMode: 'table' setting). I added a 'save' button which sends the updated data to the backend and also refetches the data. Because of a small bug on my side, this new data was ordered differently than the original. Because of this issue, I noticed that the data in my MRT table was updated only in one column, while the other did not update and the data was displayed incorrectly in the table.

I have since fixed the sorting issue on my side, but I am reporting this issue as I think this is a pretty serious bug with your library. I poked around with react devtools and noticed that the rows and cells (MRT_TableBodyRow and MRT_TableBodyCell) use indexes as React keys, instead of some per-row unique id, which may be causing this problem.

I have provided a reproduction for this issue:

Minimal, Reproducible Example - (Optional, but Recommended)

https://codesandbox.io/p/devbox/v79wqy

After pressing the reshuffle button (which simulates data being refetched in a different order), you can see only the non-editable column gets updated, while the other stays the same and the data is displayed incorrectly.

Screenshots or Videos (Optional)

Initial data:
image

data reshuffled, but second column did not update:
image

Do you intend to try to help solve this bug with your own PR?

No, because I do not know how

Terms

  • I understand that if my bug cannot be reliably reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
@Akatroj
Copy link
Author

Akatroj commented Apr 22, 2024

There is a more serious case troubled by this issue: whenever data on the backend is updated (for e.g. a new record was added from by another user), the same bug occurs, where data in the editable column will not get updated and will be displayed in incorrect rows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant