-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
mount Suspense and throw promise - Enzyme Internal Error: unknown node with tag 2 #2205
Comments
Looks related to #2125. |
Does this only occur when you throw a promise, as opposed to another kind of exception? |
Yep, |
So you're not using any Can you link me to the React docs that talk about this? https://reactjs.org/docs/code-splitting.html doesn't seem to. |
Throwing a promise inside Suspense should be the way to implement an async component - afaik. here's a pretty recent article that talks about it: The part about |
hmm, in that case perhaps the "thrown promise" case isn't something we're handling properly. |
Throwing promise inside render is supported by React Suspense. |
Hi there, is there any update on the issue? Looking forward for it to be fixed! |
Still broken? |
react-lazy-ssr triggers this error because it throws a promise. While there is a workaround, it would be nice if Enzyme supported it without the workaround. |
I also ran into this issue testing recoil with enzyme and using a value that returns a promise. It would be nice to be able to use suspense with enzyme. |
I'm working on fixing this, but the "detect fiber tags" code we use is having trouble figuring out the 17 (it has to be done dynamically so it doesn't break over time). |
@ljharb I found this problem using v1.15.6 of the adapter. I am using |
@artola i can reproduce the issue, but i can't figure out yet how to update our internals to handle it. |
I will give it a try. Thanks. |
@ljharb I did some changes and it seems to work for me (at least my test is working), but I have not your experience and broad vision. Does it makes some sense? // detectFiberTags.js
...
function LazyFn() {
throw Promise.resolve();
}
...
module.exports = function detectFiberTags() {
...
return {
FunctionalComponentLazy: supportsLazy ? getLazyFiber(LazyFn).tag : -1, // reactSixteenAdapter.js
...
case FiberTags.Lazy:
case FiberTags.FunctionalComponentLazy:
return childrenToTree(node.child); There is also a |
@artola if you can make a PR with passing tests, then that sounds awesome. |
Failing without any async nor Promise.
|
Current behavior
Getting error
Enzyme Internal Error: unknown node with tag 2
from mounting
Suspense
component with child component that throws promise:trace:
Expected behavior
No error
Your environment
API
Version
Adapter
The text was updated successfully, but these errors were encountered: