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

add shared @apollo/experimental-nextjs-app-support entry point #300

Merged
merged 7 commits into from
May 16, 2024

Conversation

phryneas
Copy link
Member

@phryneas phryneas commented May 15, 2024

This unifies @apollo/experimental-nextjs-app-support/rsc and @apollo/experimental-nextjs-app-support/ssr into @apollo/experimental-nextjs-app-support.

Once we rename the package to remove the experimental label, this will be the only entry point.

Also, some imports are changed:

  • the useQuery/useSuspenseQuery etc. hooks have been dropped. They should be imported from @apollo/client instead.
  • NextSSRApolloClient has been renamed to ApolloClient and is available in different variations from all environments, including RSC.
  • NextSSRInMemoryCache has been renamed to InMemoryCache and is available in different variations from all environments, including RSC.
  • resetNextSSRApolloSingletons has been renamed to resetApolloClientSingletons

@phryneas phryneas requested a review from a team as a code owner May 15, 2024 09:16
Copy link

relativeci bot commented May 15, 2024

#198 Bundle Size — 1.07MiB (+6.53%).

3cdf29f(current) vs afa5bcc main#189(baseline)

Warning

Bundle contains 1 duplicate package – View duplicate packages

Bundle metrics  Change 9 changes Regression 3 regressions Improvement 1 improvement
                 Current
#198
     Baseline
#189
Regression  Initial JS 938.93KiB(+5.31%) 891.55KiB
Regression  Initial CSS 70B(+100%) 0B
Change  Cache Invalidation 85.99% 0.04%
Change  Chunks 32(+33.33%) 24
Change  Assets 56(+24.44%) 45
Change  Modules 591(+15.43%) 512
Regression  Duplicate Modules 110(+266.67%) 30
Change  Duplicate Code 7.61%(+489.92%) 1.29%
Improvement  Packages 26(-10.34%) 29
No change  Duplicate Packages 1 1
Bundle size by type  Change 3 changes Regression 3 regressions
                 Current
#198
     Baseline
#189
Regression  JS 1.06MiB (+6.3%) 1MiB
Regression  Other 8.67KiB (+44.68%) 5.99KiB
Regression  CSS 70B (+100%) 0B

Bundle analysis reportBranch pr-unify-entrypointsProject dashboard

@phryneas phryneas changed the title add shared @apollo/experimental-nextjs-app-support entry point add shared @apollo/experimental-nextjs-app-support entry point May 15, 2024
Comment on lines -112 to -122
typeof window === "undefined"
? ApolloLink.from([
// in a SSR environment, if you use multipart features like
// @defer, you need to decide how to handle these.
// This strips all interfaces with a `@defer` directive from your queries.
new SSRMultipartLink({
stripDefer: true,
}),
httpLink,
])
: httpLink,
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 believe this is something that's copied blindly without any real need, so I'll omit the complexity here for now.

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 looks great to me! I absolutely love the simplification here.

export {
InMemoryCache as NextSSRInMemoryCache,
ApolloClient as NextSSRApolloClient,
Copy link
Member

Choose a reason for hiding this comment

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

Do we need a way to mark these as deprecated? Or is there another way we can hint that these exports will be removed in a future version?

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 was thinking about that, too.... I think I'll merge this as-is and add another PR for that.

Co-authored-by: Jerel Miller <jerelmiller@gmail.com>
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