-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR removes the mutation of the provided data by copying the provided data and not writing to the provided props directly.
- Loading branch information
Showing
1 changed file
with
7 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ae62214
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Domino987. With this change, this.data is not holding the original references to the original objects inside the array. In line 50, you are deconstructing row (
...row
), which also means that if it was a named object, it becomes just a plain js object. The problem with that is:onRowClick
), any developer will expect that to be the exact object that he passed before (as it was before this commit), but now this is a completely different reference.Was that supposed to be a breaking change, by design?
ae62214
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Domino987
Why did you make this change? What happened if we revert this?
ae62214
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I said in the commit message, it may be a breaking change and nothing happens if it gets reverted. The problem is, that material table mutates the data and the goal was to prevent that. Check out the commit message. Maybe we can find a better or other way.
ae62214
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now i will revert the commit. We should consider a better solution for both data and columns props.