Skip to content

Instantly share code, notes, and snippets.

@nikolal
Created November 22, 2016 12:49
Show Gist options
  • Save nikolal/b3bdfcbddc29d9ecec2a56c037fae29c to your computer and use it in GitHub Desktop.
Save nikolal/b3bdfcbddc29d9ecec2a56c037fae29c to your computer and use it in GitHub Desktop.
// NOT WORKING EXAMPLE
export class SportunityPageRoute extends Relay.Route {
static routeName = 'SportunityPageRoute';
static queries = {
all_sportunities: Component => Relay.QL`
query {
viewer {
${Component.getFragment('all_sportunities')}
}
}
`
};
}
export default Relay.createContainer(SportunityPage, {
fragments: {
all_sportunities: () => Relay.QL`fragment on Viewer{
sportunities (last: 50) {
edges{
node{
id,
title,
description,
randomDate,
nbLikes,
participants{
id,
firstName,
lastName,
pseudo
},
waiting{
id,
firstName,
lastName,
pseudo,
},
canceling{
id,
firstName,
lastName,
pseudo,
},
chat,
organizers {
id,
isAdmin,
organizer {
id,
firstName,
lastName,
pseudo,
feedbacks {
count
averageRating
}
}
},
participantRange{
from
to
},
levelRestriction {
from
to
},
sexRestriction,
ageRestriction {
from
to
},
price {
currency
cents
},
address {
country
city
zip
position {
lat
lng
}
},
sport {
id,
levels{
EN {
name
}
}
name {
FR
EN
DE
ES
},
logo,
positions {
FR
EN
DE
ES
}
}
}
}
}
}`
}
});
@nodkz
Copy link

nodkz commented Nov 22, 2016

Same problem.

You should not pass Component via variable:
all_sportunities: Component => Relay.QL
should be
all_sportunities: () => Relay.QL

@nikolal
Copy link
Author

nikolal commented Nov 22, 2016

But it is working for all_sports?

@nikolal
Copy link
Author

nikolal commented Nov 22, 2016

Just to inform you that the query is working (no errors). We are just getting empty array for sportunities.

@nikolal
Copy link
Author

nikolal commented Nov 22, 2016

While sports, venues are giving us full array.

@nikolal
Copy link
Author

nikolal commented Nov 22, 2016

screen shot 2016-11-21 at 10 43 04 pm

@nikolal
Copy link
Author

nikolal commented Nov 22, 2016

screen shot 2016-11-21 at 10 43 32 pm

@nikolal
Copy link
Author

nikolal commented Nov 22, 2016

screen shot 2016-11-21 at 10 43 57 pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment