react-smart-data-table icon indicating copy to clipboard operation
react-smart-data-table copied to clipboard

"ReferenceError: self is not defined" when using blitz

Open skhashaev opened this issue 4 years ago • 3 comments

Expected Behavior

Should show me the table with the data

Actual Behavior

Throwin error "ReferenceError: self is not defined"

Steps to Reproduce

Import the package and writing <SmartDataTable /> in the render function

Screenshot

image

Your Environment

Blitz.js is the fullstack framework includes Node.js, Next.js (Server-side rendering), React and Prisma.

skhashaev avatar Nov 07 '21 10:11 skhashaev

Thank you for submitting this issue!

I will stop transpiling the library to ES5 and it should fix this issue. Since it uses React and JSX, it will always require transpiling anyway.

joaocarmo avatar Nov 07 '21 20:11 joaocarmo

I found the solution. I can use the dynamic import for the component, where I use the SmartDataTable. For example, I have a component Table, where I use SmartDataTable, and I can dynamically import the Table component, and there will be no issue.

https://blitzjs.com/docs/code-splitting - docs about dynamic import in Blitz.js.

I don't think that the bug or something, and the package is just not made for SSR. You can add SSR support. I'm sure it will help for people. Thank you for response.

skhashaev avatar Nov 08 '21 11:11 skhashaev

Thank you for sharing your solution, @skhashaev! I'll see how I can support SSR as those technologies are becoming more popular. For the meantime, I can link this issue on the documentation.

joaocarmo avatar Nov 08 '21 23:11 joaocarmo