Closed jerelmiller closed 1 month ago
Discussing this further with the team, we believe this might cause too much confusion, so we aren't planning to pursue this at the moment.
If implemented, this would mean that useFragment
would have different behavior depending on its surrounding environment. Determining whether a fragment would suspend or not means traversing the React tree to find the query that produced the data to see if that query is a suspenseful query or not. We believe this has too much unpredictability.
Instead, we plan to add a suspensePolicy
option (or something like it) that would allow someone to determine whether to suspend on missing/pending fragment data. This would allow us to provide better type support and behave more predictably, regardless of where the query originated.
Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo Client usage and allow us to serve you better.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. For general questions, we recommend using StackOverflow or our discord server.
useFragment
should only suspend if used with a suspenseful hook (e.g.useSuspenseQuery
). If it originates fromuseQuery
, we should not suspend.We will need to determine if we need to provide a
loading
orpending
field in the event it is used withuseQuery
. If so, this field should not be available when used withuseSuspenseQuery
.