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

Invalid attempt to spread non-iterable instance #1118

Closed
xStorm11 opened this issue Dec 12, 2019 · 5 comments
Closed

Invalid attempt to spread non-iterable instance #1118

xStorm11 opened this issue Dec 12, 2019 · 5 comments
Labels

Comments

@xStorm11
Copy link

Hello, i'm currently working on a project using mui-datatables and i needed to comment the following code because it crashes the project when i use the "Select/Unselect all":
image

I didn't change the code, i even tried to use mui-datatables on other projects and i had the same error.

Expected Behavior

Select/Unselect all like the codesandbox example allows.

Current Behavior

This is what happens when i click on the checkbox:
image

Your Environment

Tech Version
Material-UI 0.3.9
MUI-datatables 2.12.4
React 16.8.6
browser Chrome, Firefox
@gabrielliwerant
Copy link
Collaborator

Hello @xStorm11, is your version of Material-UI given in this ticket the actual version you are using to produce the error? If so, note that this version is very out of date, and could be the source of your problem. See if upgrading to the latest fixes your issue (though you may need to change some other things to get it to work). If the problem persists after upgrading your Material-UI version, then I'll need to see a minimal codesandbox example that demonstrates the issue so I can find out what may be happening.

@gabrielliwerant gabrielliwerant added the needs verification For issues that can't be reproduced or are otherwise unclear label Dec 12, 2019
@patorjk
Copy link
Collaborator

patorjk commented Dec 12, 2019

@xStorm11 @gabrielliwerant I can verify this. I've fixed this in PR #1077 - it only occurs if you update babel and other packages though. It won't occur in the current setup. It's due to this line:

https://github.com/gregnb/mui-datatables/pull/1077/files#diff-4f4aff53b74d2c551e37786d32b82e3aL1164

"prevState.selectedRows" shouldn't be spread over. If you do a console.dir on it, you'll see why it can't be spread over (see #692 (comment) for more info). The version of babel this project uses just ignores the error, but it pops up if you update babel.

This PR also describes the issue: #692 (but it gives a faulty solution)

And actually, my response in that PR better explains exactly what is happening.

@gabrielliwerant gabrielliwerant added bug and removed needs verification For issues that can't be reproduced or are otherwise unclear labels Dec 12, 2019
@xStorm11
Copy link
Author

First of all, thank you very much for answer me @gabrielliwerant and @patorjk .
I follow the changes @patorjk made on newRows and it fixes my problem. I knew this was something wrong with babel but i only had this issue using mui-datatable.
Once again, thank you!

@gabrielliwerant
Copy link
Collaborator

You're welcome @xStorm11.

Keeping this open until the fix is merged in, so it can be tracked.

@patorjk
Copy link
Collaborator

patorjk commented Jun 15, 2020

Fixed as of version 3 of the table.

@patorjk patorjk closed this as completed Jun 15, 2020
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

3 participants