7.0.0-rc.15 with types do not work, with identical code from 7.0.0-rc.12 which did - potentially poor type coverage depending on if I am the cause of this error
Describe the bug
TypeError: component is null
isExoticComponent
src/publicUtils.js:265
262 |
263 | function isExoticComponent(component) {
264 | return (
> 265 | typeof component === 'object' &&
266 | typeof component.$$typeof === 'symbol' &&
267 | ['react.memo', 'react.forward_ref'].includes(component.$$typeof.description)
268 | )
isReactComponent
src/publicUtils.js:273
270 |
271 | function isReactComponent(component) {
272 | return (
> 273 | isClassComponent(component) ||
274 | isFunctionComponent(component) ||
275 | isExoticComponent(component)
276 | )
flexRender
src/publicUtils.js:246
243 | }
244 |
245 | export function flexRender(Comp, props) {
> 246 | return isReactComponent(Comp) ? <Comp {...props} /> : Comp
247 | }
248 |
249 | function isClassComponent(component) {
makeRenderer/<
src/publicUtils.js:241
238 | throw new Error(renderErr)
239 | }
240 |
> 241 | return flexRender(Comp, { ...instance, column, ...meta, ...userProps })
242 | }
243 | }
244 |
Table/</<
src/components/pages/home/index.tsx:238
235 | {headerGroups.map((headerGroup, i) => (
236 | <tr key={`hg-tr-${i}`} {...headerGroup.getHeaderGroupProps()}>
237 | {headerGroup.headers.map((column, j) => (
> 238 | <th key={`hg-th-${j}`} id={`col-${column.id}`} {...column.getHeaderProps()}>{column.render('Header')}</th>
| ^ 239 | ))}
240 | </tr>
241 | ))}
Table/<
src/components/pages/home/index.tsx:236
233 | <NodeTable {...getTableProps()}>
234 | <thead>
235 | {headerGroups.map((headerGroup, i) => (
> 236 | <tr key={`hg-tr-${i}`} {...headerGroup.getHeaderGroupProps()}>
| ^ 237 | {headerGroup.headers.map((column, j) => (
238 | <th key={`hg-th-${j}`} id={`col-${column.id}`} {...column.getHeaderProps()}>{column.render('Header')}</th>
239 | ))}
Table
src/components/pages/home/index.tsx:234
231 | </PaginationContainer>
232 | </TableBarHead>
233 | <NodeTable {...getTableProps()}>
> 234 | <thead>
| ^ 235 | {headerGroups.map((headerGroup, i) => (
236 | <tr key={`hg-tr-${i}`} {...headerGroup.getHeaderGroupProps()}>
237 | {headerGroup.headers.map((column, j) => (
./node_modules/subscriptions-transport-ws/dist/client.js/</SubscriptionClient</SubscriptionClient.prototype.request/_a.subscribe/opId<
src/client.ts:206
203 | }
204 | }
205 | else {
> 206 | resolve(options);
| ^ 207 | }
208 | }
209 | };
To Reproduce Steps to reproduce the behavior:
"@types/react-table": "^7.0.2",
"react-table": "7.0.0-rc.15",
I cannot seem to revert to 7.0.0-rc.12 now either with literally the only change being the version number and added declaration file for react-table.. what is going on?
Works fine here.
I don't see any TypeScript in your example. What's in src/components/pages/home/index.tsx?
Turns out I am the silly one. Previously for whatever reason Header: null has been allowed in the columns array, but now it isn't. This is not grabbed during type checking at compile time. Using Header: '' with desire for an empty header now works. Leaving open as this should have given a type error at compile-time, no?
@zebrahondje tagging so you get a notification as we appear to have commented at the exact same time
... Leaving open as this should have given a type error at compile-time, no?
Well, you get a TypeError telling you that the component is null, right?
Not during compile-time, only at runtime. CRA builds as completely valid.
Just to clarify that TypeError is during runtime on localhost:3000 after the data loads and the table is rendered it crashes, displaying that in the browser.
This is a type bug and not a react-table one. I think that at one time null was valid here, but it no longer is.
I'll open an appropriate bug over at definitely typed and then see about fixing it :)
That said, I'm not completely sure what the best way to fix it is. You can override the Header from the defaultColumn, and so it can legitimately be undefined in the Column, but not in the ColumnInstance.