-
Notifications
You must be signed in to change notification settings - Fork 464
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
RFC: Allow fetching to be forced to true by exchanges #444
Conversation
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.
Personally I would really like stale
(cache-and-network refetch) and partial
(partial return + fetch) flags.
With fetching going to true the user can get confused because data is returned but fetching is true, this introduces a new case in many applications. This bypasses the point of cache-and-network
being a data refresh when we want to show stale data. Many people will have if (fetching) return <Spinner />
in their code at this point.
I've discussed the point of cache-and-network
above the following will elaborate on partial
.
Partial data introducing fetching is also a bit hit and miss in my opinion since a GQL schema should be closer to what he user really sees so something nullable should also be nullable in the front-end I can't really see why that should introduce fetching.
TLDR: this is breaking
Yes, that's why this is still an RFC. I think we mainly have to validate:
Edit: on the note of “is something just missing/empty on the client or server”, I also agree that this should be represented in the schema. In the case of a list for instance, the field shouldn’t be null to indicate an empty list but instead just an empty array or a connection with an empty array of edges. |
In my opinion, having separate |
The nice thing about stale is that we could consolidate stale and partial to be the same thing since essentially they are both stale. That would actually be something I can live with since I don't want to overcomplicate our result a lot. |
Will be replaced by a new PR with |
This allows
OperationResult
to containfetching: true
which would force theuseQuery
hook to keepfetching: true
although data has already been served by an exchange.This is useful to indicate that more data is being fetched during
cache-and-network
. Hence the legacyfetching
flag could still be reproduced by doingoldFetching = fetching && !data
.