Fix minification bug in flex renderer

Fixes #1992
This commit is contained in:
Tanner Linsley 2020-04-01 16:13:50 -06:00
parent e0a6a04137
commit 9a8dc0feda
2 changed files with 17 additions and 17 deletions

View File

@ -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

View File

@ -210,18 +210,22 @@ export function flexRender(Comp, props) {
return isReactComponent(Comp) ? <Comp {...props} /> : 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)
)
}