diff --git a/CHANGELOG.md b/CHANGELOG.md index c947071..f4af87f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,11 @@ route: /changelog # React Table Changelog -## 7.0.1 🎉 +## 7.0.2 + +- Fixed an issue where the internal flexRenderer would not work correctly in production due to the strangest friggin' minification bug I've ever encountered. 🤷‍♂️ + +## 7.0.1 - Added the `value` property to cell renderers so that destructurin the value from the `cell` property is now not necessary. This should help with people migrating from v6 and also just to cut down on noise in cell renderers - Fixed an issue where rollup would not build correctly diff --git a/src/publicUtils.js b/src/publicUtils.js index 86e8c16..27302f8 100644 --- a/src/publicUtils.js +++ b/src/publicUtils.js @@ -210,18 +210,22 @@ export function flexRender(Comp, props) { return isReactComponent(Comp) ? : Comp } -function isClassComponent(component) { +function isReactComponent(component) { return ( - typeof component === 'function' && - !!(() => { - let proto = Object.getPrototypeOf(component) - return proto.prototype && proto.prototype.isReactComponent - })() + isClassComponent(component) || + typeof component === 'function' || + isExoticComponent(component) ) } -function isFunctionComponent(component) { - return typeof component === 'function' +function isClassComponent(component) { + return ( + typeof component === 'function' && + (() => { + const proto = Object.getPrototypeOf(component) + return proto.prototype && proto.prototype.isReactComponent + })() + ) } function isExoticComponent(component) { @@ -231,11 +235,3 @@ function isExoticComponent(component) { ['react.memo', 'react.forward_ref'].includes(component.$$typeof.description) ) } - -function isReactComponent(component) { - return ( - isClassComponent(component) || - isFunctionComponent(component) || - isExoticComponent(component) - ) -}