I'm trying to use decorators to simplify creating Relay containers like in this gist: https://gist.github.com/miracle2k/f39aaaccbc0d287b2ddb
Unfortunately, it's not working and erroring with Invariant Violation: RelayQueryNode: Abstract class cannot be instantiated.
There's nothing particularly interesting or strange about my code. Something similar to:
function relayDecorator(component) {
return createContainer(component, { fragments: component.fragments })
}
@relayDecorator
class Component extends React.Component {
static fragments = {
viewer: () => Relay.QL`
fragment on Viewer {
email
}
}
`
}
Does anyone have any idea why this is happening? I've tried to debug this for some time and can't get it working.
It works just fine if I create the container all by itself, outside of a decorator function.
EDIT: This has nothing to do with the decorators not working. I have decorators working just fine for other things, it is a Relay question.