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

useQuery->stale #91

Closed
wants to merge 4 commits into from
Closed

useQuery->stale #91

wants to merge 4 commits into from

Conversation

samdenty
Copy link

@samdenty samdenty commented Feb 23, 2019

Apollo doesn't seem to provide the .stale property on the currentResult, and it also returns false for loading on the first currentResult loaded from cache.

@trojanowski
Copy link
Owner

Hi @samdenty. What's your use case for this?

@samdenty
Copy link
Author

samdenty commented Mar 1, 2019

Stale returns true if the initial result was loaded from cache, and then set to false once it's been fetched from the network

const query = useQuery(QUERY, { fetchPolicy: 'cache-and-network' })
return <div style={{ opacity: query.stale ? 0.5 : 1 }}>{query.data.messageCount}</div>

levindixon pushed a commit to levindixon/react-apollo-hooks that referenced this pull request Aug 22, 2019
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

Successfully merging this pull request may close these issues.

2 participants