query($count: Int) {
users(first: $count) {
name
cursor
}
}
const mapStateToProps = () => ({ response: cashay.query(query, { variables: {count: 2}, component: 'HousekeeperList' }) });
users
, but as soon as I use:setVariables(currentVariables => {
return {
count: currentVariables.count + 2
}
})
This loops through the reqASTArgs
which is always first
and after
, so even if i comment out the line that throws here:
if (paginationMeaning === BEFORE || paginationMeaning === AFTER) {
throw new Error(`Supplying pagination cursors to cashay is not supported. ${variables}`)
}
it then throws here:
if (hasPagination === true) {
throw new Error(`Only one pagination argument can be supplied at a time. ${variables}`)
}
__typename
for example, and maybe call logout
if a return has status 401 in the afterware. One thing I did notice is that the way you do pagination is better. I like the idea of the EOF flag and also being able to fetch 11 docs and only display 10; having said that, they way you do pagination is a bit of "hidden magic" which might not make sense if you're using your graphql server for other clients, like native apps, as returning first n+1
might not be right.
null
and []
synchronously so you can load partial docs. 3. Building a django-like admin page based solely on your redux store, since your store knows about TypeNames
.
forceFetch: true
. For polling, I think a TTL is a little more eloquent than a query-specific timeout (eg a User
document is good for 1 hour, so any query involving a User
document will refetch after that.). Doing it this way let's you use the same logic for persisting your data in local/native storage.
__typename
Cashay automatically fetches this (as well as id
), although I don't think I mention that anywhere :see_no_evil:
data.objects.forEach(object => upsert(object))
stateToComputed
which triggers a re-render
Hey @mattkrick, I think the setVariables function returned with a query is not doing its job correctly. You don't seem to use it in action so I guess you haven't stumbled upon the issue, but the expected behavior in my opinion is:
Currently, it does not behave that way. If you have a query (an 'op' in cashay's terms) with a given key, then changing the arguments does nothing but changing the arguments in cashay's store (and calling the affiliated mapStateToProps again). One way to get my expected behavior would be to put all the variables in the key. However this destroys the very purpose of setVariables because then the variables in the store won't be synchronized with this "unique" key.... Perhaps you have good insights about this..