Refetch container working but replacing all items instead of appending.#1
Open
Refetch container working but replacing all items instead of appending.#1
Conversation
jgcmarins
reviewed
Jan 20, 2018
|
|
||
| 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.
you can create an alias, so you don't need to update this every time you deploy to server \o/
jgcmarins
reviewed
Jan 20, 2018
| <FlatList | ||
| data={peoplePage} | ||
| renderItem={this.renderItem} | ||
| keyExtractor={item => item.name} |
jgcmarins
reviewed
Jan 20, 2018
| page: { type: "Int", defaultValue: 1 } | ||
| ) { | ||
| peoplePage(page: $page) { | ||
| name |
|
cc @lXSPandora |
jgcmarins
reviewed
Jan 20, 2018
|
|
||
| this.props.relay.refetch( | ||
| refetchVariables, | ||
| null, |
There was a problem hiding this comment.
missing renderVariables here
see this: https://facebook.github.io/relay/docs/en/refetch-container.html#arguments
its buggy, so search for renderVariables
jgcmarins
reviewed
Jan 20, 2018
| if (isFetchingEnd === true) return; | ||
|
|
||
| if (page > 9) return; | ||
|
|
jgcmarins
reviewed
Jan 20, 2018
|
|
||
| this.setState({ | ||
| isFetchingEnd: true, | ||
| page: page + 1, |
jgcmarins
reviewed
Jan 20, 2018
| ...fragmentVariables, | ||
| page: page + 1 | ||
| }); | ||
|
|
There was a problem hiding this comment.
const renderVariables = {
page: total,
};
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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?