Skip to content

Commit

Permalink
Compare child type function string instead of function literal
Browse files Browse the repository at this point in the history
With this PR it no longer matters where the function lives in memory.

glittershark/reactable#338
  • Loading branch information
connorzg committed Jul 16, 2018
1 parent 83e1b34 commit 74c9d02
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions lib/reactable/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,16 @@ var Table = (function (_React$Component) {
return;
}

switch (child.type) {
case _thead.Thead:
switch (`${child.type}`) {
case `${_thead.Thead}`:
break;
case _tfoot.Tfoot:
case `${_tfoot.Tfoot}`:
if (typeof tfoot !== 'undefined') {
console.warn('You can only have one <Tfoot>, but more than one was specified.' + 'Ignoring all but the last one');
}
tfoot = child;
break;
case _tr.Tr:
case `${_tr.Tr}`:
var childData = child.props.data || {};

_react2['default'].Children.forEach(child.props.children, function (descendant) {
Expand Down
8 changes: 4 additions & 4 deletions src/reactable/table.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,17 @@ export class Table extends React.Component {
return;
}

switch (child.type) {
case Thead:
switch (`${child.type}`) {
case `${Thead}`:
break;
case Tfoot:
case `${Tfoot}`:
if (typeof(tfoot) !== 'undefined') {
console.warn ('You can only have one <Tfoot>, but more than one was specified.' +
'Ignoring all but the last one');
}
tfoot = child;
break;
case Tr:
case `${Tr}`:
let childData = child.props.data || {};

React.Children.forEach(child.props.children, function(descendant) {
Expand Down

0 comments on commit 74c9d02

Please sign in to comment.