Wired components getServerInitialProps error when creating operation descriptor
robertt opened this issue · 2 comments
Hiya! First, thank you for all the work done on this lib - it has saved so much time and is a pleasure to use.
I'm investigating an issue in our codebase that has popped up, and while I'm not sure the root cause I've tracked it down to this line here. When I log what query
is, it is of type ConcreteRequest
, not { default: ConcreteRequest }
like the code assumes. This obviously leads to issues since accessing .default
on ConcreteRequest
is undefined. I am very confused as there isn't anything I can see which could have changed this behavior and previously, this has worked fine.
Would be very happy to PR a quick fix to check for the existence of default
, but it's probably a better idea to figure out why this is happening/what as changed. Maybe a minor patch somewhere which gets automatically upgraded as this library is using non-obvious APIs in some cases?
As a sanity check, when I change the compiled js from const operationDescriptor = relay_runtime_1.createOperationDescriptor(query.default, variables);
to const operationDescriptor = relay_runtime_1.createOperationDescriptor(query, variables);
everything works fine.
@robertt I appreciate the kind words, and thank you for the bug report! I think this could be a difference between SWC and Webpack? At Revere we're still on Webpack due to some straggling dependencies so it would explain why we've never seen this.
Would be very happy to PR a quick fix to check for the existence of
default
Would gladly accept such a PR!