Skip to content

Conversation

jerelmiller
Copy link
Member

WIP support for lists with useFragment

const results = useFragment({
  fragment,
  from: [item1, item2]
});

console.log(results); // [{ data: {...}, complete: true }, { data: {...}, complete: true }}]

Copy link

changeset-bot bot commented Oct 13, 2025

⚠️ No Changeset found

Latest commit: 1bb3371

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@apollo-librarian
Copy link

apollo-librarian bot commented Oct 13, 2025

✅ Docs preview ready

The preview is ready to be viewed. View the preview

File Changes

0 new, 10 changed, 0 removed
* (developer-tools)/react/(latest)/caching/cache-configuration.mdx
* (developer-tools)/react/(latest)/data/fragments.mdx
* (developer-tools)/react/(latest)/data/mutations.mdx
* (developer-tools)/react/(latest)/data/persisted-queries.mdx
* (developer-tools)/react/(latest)/data/queries.mdx
* (developer-tools)/react/(latest)/integrations/react-native.mdx
* (developer-tools)/react/(latest)/migrating/apollo-client-4-migration.mdx
* (developer-tools)/react/(latest)/performance/server-side-rendering.mdx
* (developer-tools)/react/(latest)/VERSIONING_POLICY.md
* (developer-tools)/react/(latest)/versioning-policy.md

Build ID: 744dea42ff35373e23f62728
Build Logs: View logs

URL: https://www.apollographql.com/docs/deploy-preview/744dea42ff35373e23f62728

Copy link

pkg-pr-new bot commented Oct 13, 2025

npm i https://pkg.pr.new/apollographql/apollo-client/@apollo/client@12971

commit: 1bb3371

}) as Observable<any>;

return Object.assign(observable, {
getCurrentResult: () => {
Copy link
Member

Choose a reason for hiding this comment

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

Could we return something with a changeTargets property here? That way we wouldn't need to unwatch/rewatch 999 unrelated elements if one id changed.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes! I was planning to do that next 🙂.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is now implemented with reobserve which will only watch new ids and keep ids that haven't changed around 🙂

@jerelmiller jerelmiller force-pushed the jerel/use-fragment-list branch from 567a907 to 1bb3371 Compare October 16, 2025 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants