question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

React Table 8.7.4 breaks on NextJS 13

See original GitHub issue

Describe the bug

What’s the issue?

React table breaks on Next JS 13 ONLY on production builds. I can confirm that it happens both locally (next build && next start) and in the Vercel environment. My app is not using any SSR and only SSG pages.

It works fine on development but when we run a production build the react table throws an error. I did an initial investigation/debugging but I could not confirm if this is a problem with React Table itself, but I was able to reproduce it with a very simple demo.

Version/Environment

  • NodeJS: Tested on Node v14 and v16.
@tanstack/react-table": "^8.7.4"
next": "13.0.7"

Investigation

I had a quick look at the issue and at the source code and it seems that the table getAllLeftColumns is returning undefined, and I did a quick debug to read all table states and it seems getAllColumns is also returning undefined. Sorry I didn’t investigate more as I am new to the source code, so I thought about posting it here to get some directions if this is a known issue or if there are any tips - otherwise I am more than happy to jump in and properly debug the issue.

image

How to reproduce?

  1. Clone the repository https://github.com/lucashfreitas/react-table-nextjs-issue
  2. Install the packages and run npm run dev and see that the table works just fine.
  3. Run the build command to generate a production build: npm run build.
  4. Run the start command which runs the production-built version locally: npm run start.
  5. Notice that react table will break as per screenshot

Your minimal, reproducible example

https://github.com/lucashfreitas/react-table-nextjs-issue

Steps to reproduce

  1. Clone the repository https://github.com/lucashfreitas/react-table-nextjs-issue
  2. Install the packages and run npm run dev and see that the table works just fine.
  3. Run the build command to generate a production build: npm run build.
  4. Run the start command which runs the production-built version locally: npm run start.
  5. Notice that react table will break as per screenshot

Expected behavior

I expected the react table to work with nextjs.

How often does this bug happen?

Often

Screenshots or Videos

No response

Platform

OS: MacOs, Linux (vercel environment) Browsers: Chrome/Firefox

react-table version

8.7.4

TypeScript version

4.9.4

Additional context

No response

Terms & Code of Conduct

  • I agree to follow this project’s Code of Conduct
  • I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.

Issue Analytics

  • State:closed
  • Created 9 months ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

1reaction
OmerWowcommented, Dec 21, 2022

@gempi @ekwoka @lucashfreitas

This is because Next.js 13 enabled SWCMinify by default, disabling it fixes the problem without having to use an older version of React Table.

Read my comment over here https://github.com/TanStack/table/issues/4610#issuecomment-1357263699 as this has already been discussed on in another issue.

0reactions
lucashfreitascommented, Dec 21, 2022

I will close this issue as it’s a duplicate of #4604 and #4610 . Thanks @OmerWow

Read more comments on GitHub >

github_iconTop Results From Across the Web

react table breaks after updating next from 12.0.7 to 12.0.8
It's very likely that your issue has remained here this long because it would require breaking changes to v7. React Table v8 is...
Read more >
react-table has a issue with rendering in next.js
Confused about trying to solve this issue - Is it to do with how next.js works? Update. After implementing typescript types for react-table...
Read more >
Nextjs react table
This is a [Next.js](https://nextjs.org/). project bootstrapped with [`create-next-app`]. (https://github.com/vercel/next.js/tree/.
Read more >
mozilla-central: changeset 406747 ...
-if (false) { - var REACT_ELEMENT_TYPE = (typeof Symbol ... so that if you enable - // "break on all exceptions" in your...
Read more >
atlassian / Atlaskit-MK-2 / Compare
... harsha/nav-next-lite, harsha/nav-v3-theming, harsha/next-js-spike, harsha/page-layout, harsha/pageBanner, harsha/prevent-unmount-on-collapse-alternate ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found