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

RelayOSSNodeInterface: Expected root field to be a single non-array result #378

Closed
aweary opened this issue Sep 23, 2015 · 2 comments
Closed

Comments

@aweary
Copy link
Contributor

aweary commented Sep 23, 2015

I have a GraphQL server running that exposes property as a root field, with the following schema:

export const property = {
  type: new GraphQLList(propertyType),
  args: {
    id: {
      description: 'ID of the property',
      type: new GraphQLList(GraphQLInt)
    }
  },
  resolve: resolver(Property)
};

It should return a list of propertyType items which have properties such as propertyName, propertyDescription, etc.

const query = new GraphQLObjectType({
  name: 'RootQueryType',
  fields: () => fields
});

property is a property of the returned fields object and everything works fine with direct queries. Now I also have a Relay app with the route:

export default class extends Relay.Route {
  static queries = {
    property: () => Relay.QL`query { property }`
  };
  static routeName = 'PropertyRoute';
}

Which is used by the component

class Property extends React.Component {
    render() {
      console.log(this.props);
      return (
        <div>
          <ul>
          <p> I dont do anything yet </p>
          </ul>
        </div>
      );
    }
  }

export default Relay.createContainer(Property, {
  fragments: {
    property: () => Relay.QL`
      fragment on Property {
        propertyName,
        id
      }
    `
  }
});

The issue is, I'm getting the error:

Invariant Violation: RelayOSSNodeInterface: Expected payload for root field `property` to be a single non-array result, instead received an array with 300 results.

300 is the right number and what I want is a property property returned with an array of objects with the propertyName and id. I thought #361 would fix it, but I've pulled and built the most current version of Relay from this repository and the issue still occurs.

@josephsavona
Copy link
Contributor

This relates to #112

@aweary
Copy link
Contributor Author

aweary commented Sep 24, 2015

👍 closing

@aweary aweary closed this as completed Sep 24, 2015
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