Draft
Conversation
e1d349b to
113fdf7
Compare
There was a problem hiding this comment.
Pull request overview
This PR rewrites Glimmer Apollo’s internal resource implementation to use ember-resources primitives, introducing first-class resource factories for @use/template usage while keeping useQuery/useMutation/useSubscription as convenience wrappers.
Changes:
- Replaced the custom resource lifecycle implementation with
ember-resources(resource,resourceFactory,@use,use). - Introduced/standardized the new primary APIs:
queryResource,mutationResource,subscriptionResourcepluscreate*Resourcecurried variants. - Updated tests and documentation to cover and recommend the new factory-based usage patterns.
Reviewed changes
Copilot reviewed 21 out of 23 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| test-app/tests/unit/query-test.ts | Adds coverage for Apollo Client 4 refetch behavior on skipped/standby queries. |
| test-app/tests/unit/custom-query-test.ts | Updates “custom query” composition to use the new queryResource factory + use. |
| test-app/tests/integration/components/resource-factory-test.gts | New integration tests validating @use, template invocation via resourceFactory, and curried factories. |
| test-app/package.json | Adds ember-resources to the test app dependencies. |
| test-app/app/components/experiment.gts | Migrates demo component usage from useQuery/useMutation to @use + resource factories. |
| pnpm-lock.yaml | Locks ember-resources dependency additions. |
| glimmer-apollo/src/index.ts | Exposes resource factories as the primary API and keeps use* wrappers as convenience exports. |
| glimmer-apollo/src/environment.ts | Removes exports only needed by the old custom Resource/helper-manager implementation. |
| glimmer-apollo/src/-private/use-resource.ts | Deletes the old useResource/helper-manager based implementation. |
| glimmer-apollo/src/-private/usables.ts | Reimplements useQuery/useMutation/useSubscription wrappers using ember-resources use(...). |
| glimmer-apollo/src/-private/types.ts | Removes types tied to the deleted custom resource framework. |
| glimmer-apollo/src/-private/subscription.ts | Rewrites subscriptions to ember-resources + proxy invalidation; adds curried factory. |
| glimmer-apollo/src/-private/resource.ts | Deletes the custom Resource base class and helper manager. |
| glimmer-apollo/src/-private/query.ts | Rewrites queries to ember-resources + proxy invalidation; adds curried factory. |
| glimmer-apollo/src/-private/observable.ts | Refactors observable helper base to no longer depend on the removed Resource base class. |
| glimmer-apollo/src/-private/mutation.ts | Rewrites mutations to ember-resources; adds curried factory. |
| glimmer-apollo/package.json | Adds ember-resources as dev + peer dependency for the addon package. |
| docs/fetching/subscriptions.md | Updates docs to recommend subscriptionResource + @use and keeps useSubscription as alternative. |
| docs/fetching/queries.md | Updates docs to recommend queryResource + @use and keeps useQuery as alternative. |
| docs/fetching/mutations.md | Updates docs to recommend mutationResource + @use and keeps useMutation as alternative. |
| UPGRADE.md | Documents the new factory APIs, curried factories, and removed helper type exports. |
| README.md | Updates README examples to the new recommended @use + resource factory API. |
| .claude/settings.local.json | Adds an empty local settings file. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)
glimmer-apollo/src/-private/subscription.ts:70
- In FastBoot,
_startreturns early whenoptions.ssr === falsebut leavesloadingset totrue(andpromiseunset). That can leave consumers stuck in a perpetual "connecting" state during SSR. Consider settingloading=falseandpromise=Promise.resolve()(and ensuringhasActiveSubscriptionremains false) before returning.
this.loading = true;
const fastboot = getFastboot(this);
if (fastboot && fastboot.isFastBoot && options && options.ssr === false) {
return;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
122
to
124
| import { | ||
| ON_MESSAGED_ADDED, | ||
| OnMessageAddedSubscription, |
There was a problem hiding this comment.
The identifier ON_MESSAGED_ADDED in this example looks like a typo (extra “D”). Renaming it to ON_MESSAGE_ADDED would avoid confusion for readers copying the snippet.
dee5b9d to
971196e
Compare
971196e to
4dbacf7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rewrite internals to use ember-resources
Replaces the custom Resource base class and useResource helper with https://github.com/NullVoxPopuli/ember-resources primitives (resource, resourceFactory, @use).
What changed
New curried factory API
Backward compatible
useQuery, useMutation, and useSubscription continue to work unchanged.
Cowritten by claude