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

Invalid prop type applied to Map component (plus several others) #58

Open
komali2 opened this issue Jun 14, 2018 · 0 comments
Open

Invalid prop type applied to Map component (plus several others) #58

komali2 opened this issue Jun 14, 2018 · 0 comments
Assignees

Comments

@komali2
Copy link
Contributor

komali2 commented Jun 14, 2018

There are one, or possibly three, bugs regarding how the App is initialized and sets up the Map component.

The code:

App.jsx

  loadRelay() {
    return (
      <QueryRenderer
        environment={this.state.environment}
        query={graphql`
            query AppAllVehiclesQuery($agency: String!, $startTime: String!, $endTime: String!) {
              ...Map_trynState
            }
          `}
        variables={{
          agency: 'muni',
          startTime: Date.now() - 15000,
          endTime: Date.now(),
        }}
        render={({ error, props }) => {
          if (error) {
            return <div>{error.message}</div>;
          } else if (props) {
            return (
              <Map trynState={props} />
            );
          }
          return <div>Loading</div>;
        }}
      />
    );
  }

This issue is about how the {props} variable passed to <Map> is bad somehow. Error is in browser:

index.js:2177 Warning: Failed prop type: Invalid prop `relay` of type `object` supplied to `Map`, expected a single ReactElement.
    in Map (created by Relay(Map))
    in Relay(Map) (at App.jsx:49)
    in ReactRelayQueryRenderer (at App.jsx:32)
    in div (at App.jsx:60)
    in App (at index.jsx:10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants