-
Notifications
You must be signed in to change notification settings - Fork 37
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
Warn if ssrMode
or ssrForceFetchDelay
are used.
#358
Conversation
✅ Deploy Preview for apollo-client-nextjs-docmodel ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
for (const warning of warnings) { | ||
console.warn(warning, info.pkg, "ApolloClient"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is down here because we need access to info
, which relies on this
, which is only available after the super
call - but we want to remove these options before that call.
size-limit report 📦
|
#264 Bundle Size — 1.1MiB (+0.03%).197ba3e(current) vs e6bfd3a main#263(baseline) Warning Bundle contains 1 duplicate package – View duplicate packages Bundle metrics
|
Current #264 |
Baseline #263 |
|
---|---|---|
Initial JS | 924.27KiB (+0.04% ) |
923.9KiB |
Initial CSS | 70B |
70B |
Cache Invalidation | 22.66% |
22.66% |
Chunks | 33 |
33 |
Assets | 57 |
57 |
Modules | 588 |
588 |
Duplicate Modules | 99 |
99 |
Duplicate Code | 6.23% |
6.23% |
Packages | 26 |
26 |
Duplicate Packages | 1 |
1 |
Bundle size by type 1 change
1 regression
Current #264 |
Baseline #263 |
|
---|---|---|
JS | 1.09MiB (+0.03% ) |
1.09MiB |
Other | 8.78KiB |
8.78KiB |
CSS | 70B |
70B |
Bundle analysis report Branch pr/warn-on-useless-options Project dashboard
Generated by RelativeCI Documentation Report issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call on this one!
commit: |
@phryneas Actually, this change is causing an issue with the application we are using. Specifically, with PreloadQuery, a query is first executed on the RSC, and then the same query is executed again on the client side. This is causing duplicate requests in all places where we are using useSuspenseQuery. Until the PR is shipped, I had been able to prevent the client-side query execution after the RSC query by setting I think there may be others facing the same issue. Do you know of any way to prevent duplicate requests between RSC and the client side? Or is there any point I might be overlooking? |
Hi @t-tiger, |
I'm sorry for the delayed response. Allow me to ask the follow-up question 🙇 I think I could understand the design intent of the library. After reading this comment, I see that @apollo/experimental-nextjs-app-support is designed to make the client transparent to server-side and use Duplicate requests can be reproduced by setting the fetchPolicy to However, my use case differs. Here are the underlying conditions:
For point 1, it's difficult for developers to keep specifing For point 2, when browser back/forward occurs, Next.js does not re-render page.tsx and stale data will be displayed if fetchPolicy is When these two cases combine, using I think this kind of situation can occur, but is the design intent of the library is to use |
That fetch policy is the right choice only in very rare cases, I would not recommend to use it as a default, especially not without combining it with a
As a user, honestly I would be quite taken aback if I were to press the back button and get different information than I saw previously - but this is your call to make in the end.
You might have gotten your desired result on accident, but you are really relying on undefined behaviour here that might change on a whim. This library is not designed to be used with these options and they are not supported. What I read here is that you are running into problems using the hooks in certain situations with certain network policies - this seems like a XY-Problem: We are discussing |
Thank you for your response. Understood. It would have been better to open an issue rather than asking in the PR. My apologies for it. |
I've seen this a few times too often now.