glittershark / reactable

Fast, flexible, and simple data tables in React
glittershark.github.io/reactable
MIT License
1.51k stars 222 forks source link

Doesn't work with React-hot-loader #338

Open patrik-piskay opened 7 years ago

patrik-piskay commented 7 years ago

When using RHL (version 3.0.0-beta6), error The only possible children of <Table> are <Thead>, <Tr>, or one <Tfoot> is thrown with no table being rendered.

gbenson-wikia commented 7 years ago

This appears to be caused by reactable/table.jsx::parseChildData()'s mechanism for checking to see if the children are the types it's expecting. child.type returns the function used to create the child component, and RHL will have swapped out the function with a copy of itself. But, since they merely contain the same code (and don't point to the same in-memory instance of the function), JS doesn't see them as being the same function.

I'm unsure that this is something that RHL would be able to fix, though it's probably worth opening a ticket over there, too.

I think there's an easy fix for this on the reactable side, where reactable adds add a "reactable component type" static string variable to each of the reactable components, and checks against that in the switch instead.

@glittershark - If you'd be open to this as an approach, I can try to put together a PR. What do you think?

bf commented 7 years ago

@glittershark any comments?

mohitgarg commented 6 years ago

I am facing the same issue. Have you guys found any solution?

thabti commented 6 years ago

Still facing similar issue :( with react-hot-loader 4