wojtekmaj / enzyme-adapter-react-17

Unofficial adapter for React 17 for Enzyme.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

React.Suspense is broken

Hypnosphi opened this issue · comments

Whenever I mount a tree with React.Suspense, it throws:

Error: Enzyme Internal Error: unknown node with tag 23

    at _toTree (/Users/jetbrains/IdeaProjects/TeamCity/react-ui/node_modules/@wojtekmaj/enzyme-adapter-react-17/src/ReactSeventeenAdapter.js:166:3)
    at childrenToTree (/Users/jetbrains/IdeaProjects/TeamCity/react-ui/node_modules/@wojtekmaj/enzyme-adapter-react-17/src/ReactSeventeenAdapter.js:292:4)

Brief debugging showed that this probably is the new Offscreen fiber type

Looks like we need to add something in detectFiberTags.js. But since Offscreen isn't exposed I have no clue on how to do this, hmmm...

Render Suspence and get the type of its only child?

@Hypnosphi can you use this branch and test if this works for you? #3