apollographql / apollo-client-nextjs

Apollo Client support for the Next.js App Router
https://www.npmjs.com/package/@apollo/experimental-nextjs-app-support
MIT License
351 stars 25 forks source link

[experiment/idea] allow enabling "forced suspense" for useQuery hook in SSR #226

Open phryneas opened 1 month ago

phryneas commented 1 month ago

This came up in https://community.apollographql.com/t/streaming-without-suspense-in-apollo-nextjs-client/7259 - essentially, we could allow users to opt useQuery into suspending during SSR, so useQuery result could also be streamed from SSR instead of just rendering a "loading" indicator in SSR.

If we actually want to do this, it should probably be documented as a "you can do this while you are migrating to suspense" approach.

relativeci[bot] commented 1 month ago

Job #116: Bundle Size — 1.01MiB (+0.65%).

b1a2f84(current) vs 1f8cda5 main#115(baseline)

[!WARNING] Bundle contains 1 duplicate package – View duplicate packages

Bundle metrics  Change 5 changes Regression 1 regression
                 Current
Job #116
     Baseline
Job #115
Regression  Initial JS 892.78KiB(+0.25%) 890.58KiB
No change  Initial CSS 0B 0B
Change  Cache Invalidation 15.31% 0%
Change  Chunks 25(+4.17%) 24
Change  Assets 47(+4.44%) 45
Change  Modules 514(+0.39%) 512
No change  Duplicate Modules 30 30
No change  Duplicate Code 1.29% 1.29%
No change  Packages 29 29
No change  Duplicate Packages 1 1

Bundle size by type  Change 2 changes Regression 2 regressions
|            |       Current
[Job #116](https://app.relative-ci.com/projects/fukE5WxC5RnzLcZncFJw/jobs/116-RHCrbNOzmKfeZSEegdmI?utm_source=github&utm_medium=pr-report "View job report") |      Baseline
[Job #115](https://app.relative-ci.com/projects/fukE5WxC5RnzLcZncFJw/jobs/115-9xgEFBbUDuVGFYBVjWlB?utm_source=github&utm_medium=pr-report "View baseline job report") | |:--|--:|--:| | Regression  [JS](https://app.relative-ci.com/projects/fukE5WxC5RnzLcZncFJw/jobs/116-RHCrbNOzmKfeZSEegdmI/assets?ba=%7B%22filters%22%3A%22ft.CSS-0_ft.JS-1_ft.IMG-0_ft.MEDIA-0_ft.FONT-0_ft.HTML-0_ft.OTHER-0%22%7D "View JS assets") | `1.01MiB` (`+0.62%`) | `1023.84KiB` | | Regression  [Other](https://app.relative-ci.com/projects/fukE5WxC5RnzLcZncFJw/jobs/116-RHCrbNOzmKfeZSEegdmI/assets?ba=%7B%22filters%22%3A%22ft.CSS-0_ft.JS-0_ft.IMG-0_ft.MEDIA-0_ft.FONT-0_ft.HTML-0_ft.OTHER-1%22%7D "View Other assets") | `6.38KiB` (`+6.37%`) | `5.99KiB` |

View job #116 reportView pr/useQuery_forcedSuspense branch activityView project dashboard

phryneas commented 1 month ago

/release:pr

github-actions[bot] commented 1 month ago

A new release has been made for this PR. You can install the package you need using one of

github-actions[bot] commented 3 weeks ago

size-limit report 📦

Path Size
{ ApolloNextAppProvider, NextSSRApolloClient, NextSSRInMemoryCache } from '@apollo/experimental-nextjs-app-support/ssr' (Browser ESM) 7.78 KB (0%)
{ WrapApolloProvider, ApolloClient, InMemoryCache } from '@apollo/client-react-streaming' (Browser ESM) 1.4 KB (0%)
{ buildManualDataTransport } from '@apollo/client-react-streaming/manual-transport' (Browser ESM) 6.29 KB (+0.39% 🔺)
@apollo/client-react-streaming (Browser ESM) 2.15 KB (+1.11% 🔺)
@apollo/client-react-streaming (SSR ESM) 1.91 KB (+9% 🔺)
@apollo/client-react-streaming (RSC ESM) 1.36 KB (0%)
@apollo/client-react-streaming/manual-transport (Browser ESM) 6.48 KB (+0.41% 🔺)
@apollo/client-react-streaming/manual-transport (SSR ESM) 6.5 KB (+2.51% 🔺)
@apollo/experimental-nextjs-app-support/ssr (Browser ESM) 8.41 KB (0%)
@apollo/experimental-nextjs-app-support/ssr (SSR ESM) 8.33 KB (+0.03% 🔺)
@apollo/experimental-nextjs-app-support/ssr (RSC ESM) 867 B (0%)
@apollo/experimental-nextjs-app-support/rsc (RSC ESM) 626 B (0%)