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

useFragment: remove returnPartialData option #10836

Merged
merged 4 commits into from
May 9, 2023

Conversation

phryneas
Copy link
Member

@phryneas phryneas commented May 4, 2023

Checklist:

  • If this PR contains changes to the library itself (not necessary for e.g. docs updates), please include a changeset (see CONTRIBUTING.md)
  • If this PR is a new feature, please reference an issue where a consensus about the design was reached (not necessary for small changes)
  • Make sure all of the significant new logic is covered by tests

@changeset-bot
Copy link

changeset-bot bot commented May 4, 2023

🦋 Changeset detected

Latest commit: 784fe04

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Comment on lines -43 to -55
// Since the above definition of UseFragmentOptions can be hard to parse without
// help from TypeScript/VSCode, here are the intended fields and their types.
// Uncomment this code to check that it's consistent with the definition above.
//
// export interface UseFragmentOptions<TData, TVars> {
// from: string | StoreObject | Reference;
// fragment: DocumentNode | TypedDocumentNode<TData, TVars>;
// fragmentName?: string;
// optimistic?: boolean;
// variables?: TVars;
// returnPartialData?: boolean;
// canonizeResults?: boolean;
// }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this comment and added a type test for this interface shape instead.

@@ -84,9 +62,10 @@ export function useFragment_experimental<

const diffOptions: Cache.DiffOptions<TData, TVars> = {
...rest,
returnPartialData: true,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

forcing returnPartialData to true in case someone isn't using TypeScript and keeps using the option.

@phryneas phryneas marked this pull request as ready for review May 4, 2023 09:14
Copy link
Member

@jerelmiller jerelmiller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change looks great! I like this decision a lot. Feel free to accept/skip any of my formatting suggestions.

src/react/hooks/__tests__/useFragment.test.tsx Outdated Show resolved Hide resolved
src/react/hooks/__tests__/useFragment.test.tsx Outdated Show resolved Hide resolved
Copy link
Member

@alessbell alessbell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙌

@phryneas phryneas merged commit 6794893 into release-3.8 May 9, 2023
@phryneas phryneas deleted the pr/useFragment-remove-returnPartialData branch May 9, 2023 13:29
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants