Fix wrong higher order wrapping #112
Merged
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
@Chun-MingChen
Sorry that I make a mistake about
React.cloneElement
.. I expect to useReact.cloneElement
to wrap the element again and again for the reason of separating the heavy logic to different and small components.So I defined the three wrapper:
./packages/react-bootstrap-table2/src/sort/wrapper.js
./packages/react-bootstrap-table2/src/row-selection/wrapper.js
./packages/react-bootstrap-table2/src/cell-edit/wrapper.js
And in the
render
method of./packages/react-bootstrap-table2/src/container.js
, I useReact.cloneElement
to wrap a react element dynamically(I mean it depend on props that user given)Actually all of those stuff is work until I found a bug when we render with one more wrappers,
for example, if user define a table with sort and row selection or
a table with row selection and cell edit, the bug will be produced...
However, if a table only render with one wrapper, that will be fine. That's why some lately to found this bug..
Let me know your idea or if there's any unclear and I'll fix the testing in these couple days(tomorrow)