-
Notifications
You must be signed in to change notification settings - Fork 0
Refetch container working but replacing all items instead of appending. #1
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
base: eslint
Are you sure you want to change the base?
Conversation
|
|
||
| const fetchQuery = async (operation, variables, cacheConfig, uploadables) => { | ||
| const response = await fetch('https://graphql-sw-api-klmkpknwdl.now.sh/', { | ||
| const response = await fetch('https://graphql-sw-api-gxmdjgcfhi.now.sh/', { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can create an alias, so you don't need to update this every time you deploy to server \o/
| <FlatList | ||
| data={peoplePage} | ||
| renderItem={this.renderItem} | ||
| keyExtractor={item => item.name} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe it's better to use an id here
| page: { type: "Int", defaultValue: 1 } | ||
| ) { | ||
| peoplePage(page: $page) { | ||
| name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can ask for id here
|
cc @lXSPandora |
|
|
||
| this.props.relay.refetch( | ||
| refetchVariables, | ||
| null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing renderVariables here
see this: https://facebook.github.io/relay/docs/en/refetch-container.html#arguments
its buggy, so search for renderVariables
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then add here:
renderVariables,| if (isFetchingEnd === true) return; | ||
|
|
||
| if (page > 9) return; | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add here:
const total = page + 1;|
|
||
| this.setState({ | ||
| isFetchingEnd: true, | ||
| page: page + 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
page: total,| ...fragmentVariables, | ||
| page: page + 1 | ||
| }); | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const renderVariables = {
page: total,
};
Refetch container working but replacing all items instead of appending. New items should be added to end of list. Is it possible with refetch container?