-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
chore(docs): add useFragment_experimental documentation #10099
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.
Approved on the docs side with suggestions!
@StephenBarlow thanks for all the great bits of feedback. 🙏 I like this a lot, but I'm curious if we could add a clear use case or example as I find it nice when we say things like: Let's say you want to do X with Y... Well here is how you can with this new thing we are releasing... |
@jpvajda That addition might make the most sense as a separate section (marked "experimental") in this doc: https://www.apollographql.com/docs/react/caching/cache-interaction The hook is always for reading and reacting to changes in cached data, correct? |
Thanks for the review, @StephenBarlow! I like the idea of adding a section to the cache-interaction page - I should be able to wrap this up tomorrow 😄 |
f7dd0b3
to
c26fb36
Compare
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.
Details 😈
docs/shared/useFragment-options.mdx
Outdated
|
||
<td> | ||
|
||
**Required.** The cached object (or object reference) for the fragment being retrieved. |
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.
**Required.** The cached object (or object reference) for the fragment being retrieved. | |
**Required.** An object containing a `__typename` and primary key fields (such as `id`) identifying the entity object from which the fragment will be retrieved, or a `{ __ref: "..." }` reference, or a `string` ID (uncommon) |
Need to be a little more specific than "the cached object"
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.
Thanks, +1 for the details and updated the PR 👍 I took this from the InMemoryCache
docs section on the identify
method's signature and would be happy to update it there too.
docs/shared/useFragment-result.mdx
Outdated
|
||
<td> | ||
|
||
An object or string containing an error message or path to cached items with corresponding error messages. |
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.
An object or string containing an error message or path to cached items with corresponding error messages. | |
A tree of all `MissingFieldError` messages reported during fragment reading, where the branches of the tree indicate the paths of the errors within the query result |
I should mention I'm especially open to feedback on this part of the (experimental) API. The MissingTree
can be a lot more compact than a list of error objects, but some details require explanation, like how arrays are represented as objects in the MissingTree
(because they tend to be sparse).
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.
Makes sense, made that update - I'm curious about the best way to solicit feedback here but that's a more general question about the way we gather input on features in beta/preview.
c26fb36
to
ee2ff81
Compare
Closes #10056. Adds
useFragment_experimental
documentation.This PR:
useFragment_experimental
useFragment_experimental
in the table at the top of the cache interaction page and section that points people to the API reference for the hookTo do:
useFragment_experimental
to cache-interaction pageChecklist: