Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: Support function components wrapped in memo #19

Closed
kyelewis opened this issue Sep 8, 2021 · 3 comments
Closed

Request: Support function components wrapped in memo #19

kyelewis opened this issue Sep 8, 2021 · 3 comments

Comments

@kyelewis
Copy link

kyelewis commented Sep 8, 2021

Want to say, this library is great.. maybe i'll find time to dive in and try to work this out myself, but if not:

Inlining function components wrapped in memo() returns this error:

    TypeError: renderMethod is not a function

      at node_modules/isolate-components/lib/isolatedRenderer/index.js:27:28
      at render (node_modules/isolate-hooks/lib/index.js:38:40)
      at Object.render (node_modules/isolate-components/lib/isolatedRenderer/index.js:33:9)
      at forEach (node_modules/isolate-components/lib/nodeTree/inline.js:16:43)
          at Array.forEach (<anonymous>)
      at Object.doInline (node_modules/isolate-components/lib/nodeTree/inline.js:14:23)
      at forEach (node_modules/isolate-components/lib/nodeTree/inline.js:20:21)
          at Array.forEach (<anonymous>)
      at Object.doInline (node_modules/isolate-components/lib/nodeTree/inline.js:14:23)
      at node_modules/isolate-components/lib/nodeTree/inline.js:20:21

When not inlining, they appear as <undefined ...> in toString() output.

It'd be great to support them if it's a simple thing!

isolate-components v1.1.3, react 17, react-native

@davidmfoley
Copy link
Owner

thanks for the report; I made a quick workaround in 1.1.4 and will fix this for real later -- note that in 1.1.4 no memoization actually occurs (it is rendered each time, regardless of props) -- see the tests here 5482de9#diff-7cf99adf8ee22020366a84d2a751bccf8fc3e43029c9df2e7c75b2d72c8213d0 (note the skipped test as well)

@kyelewis
Copy link
Author

kyelewis commented Sep 9, 2021

Thanks @davidmfoley for the fast turnaround!

@davidmfoley
Copy link
Owner

Added React.memo support "for real" in v1.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants