-
Notifications
You must be signed in to change notification settings - Fork 932
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
Text Label props #878
Comments
I wasn't able to reproduce the issue with the information here. I loaded the
Nothing breaks for me when I do that. |
I had this problem today as well. When I removed the
Stack trace is as follow:
I tried with just |
Yep, this is a bug - it's a tricky one though. Check out this CodeSandbox: https://codesandbox.io/s/muidatatables-custom-toolbar-5gwgy To see the bug, hit the "loading" toggle. It looks like it's possibly related to more than textLabels, but if you comment "textLabels" out of the options, it doesn't appear (which is probably why I don't see it in my app - I don't use that option). Checking the versions, it looks like it was introduced in version 2.8.1. Side note: I'm running low on Sandboxes, so after this issue is resolved I'll probably deleted that sandbox. |
So this bug has subtle affects elsewhere. If you set selectableRows to "false" in your options. The table will initially change it to "none" for you and print a warning in the console. However, once the state updates and the table re-renders with new props, this value gets reset back to "false" and the table will print an error in the console and the checkboxes will become visible. This issue looks like it was introduced when merge was changed to assign 2.8.1: I'd have to better understand why the change was made, but I think this can be resolved by using "mergeWith" and selectively merging from the newProp object. Below is something I played around with which seems to work - but I'm not totally familiar with why the change was made so I can't say for certain if this would fix everything. It does fix the above textLabels and selectableRows issues though.
|
This is kind of a big bug, so thanks for the detective work @patorjk and for opening the issue @Avd6977. I needed to see the exact situation that leads to the issue, which is when the table updates. We can't use Working on a fix as we speak, and will issue a patch when done. |
Sounds good - you may want to try out mergeWith like in my example above. It’s like merge, but it allows you to override how merge works. Above I have it act like assign unless the property type is object or undefined. I think it gives the desired behavior but am not 100% sure. |
@patorjk I think I was able to get there with |
@gabrielliwerant Sure, I'll check it out here in a few minutes. If I have any comments I'll post them on the PR. |
Thanks @patorjk and @gabrielliwerant. Been away all weekend so haven't had the chance to do the demo/explain. |
* Fixes for issues gregnb#878 and gregnb#887 * Changing hint to label * Making the columnHeaderTooltip customizable for any column prop * Resolving comments * Add option to readme * Doc update
Expected Behavior
Passing in text label props to use defaults if not overridden
Current Behavior
Passing custom text label props that don't include the default breaks loading
e.g.
Steps to Reproduce (for bugs)
Pass in the prop above
Your Environment
The text was updated successfully, but these errors were encountered: