-
Notifications
You must be signed in to change notification settings - Fork 786
ssr: false still sends request to server rendering serverside #3500
Comments
@maapteh is it working for you? This is happening for me in Gatsby SSR as well. I have set ssr={false} but it would still fire off requests to the server. I ended up using the |
Hi @senorgeno its still happening but i thought its because i updated to NextJs 9 at the same time. So its difficult to know for me the reason why since the other ssr: false issue was closed and working for other people i thought it must be with NextJS since they do stuff in order to do things serverside or not... I debugged a little further and the treewalker gives indeed only the result which has ssr: true (rendertostring) but as a side effect the others are called as well (not put in store for rehydration) and then client side again. Skip is indeed working like it should but then i need to add another hook... |
I only have a reproduction with a private key for the api part... :( will try to make another |
@hwillson i found the issue in @apollo/react-hooks
when i added |
@senorgeno you will not need the hack anymore when the PR gets merged :) |
@maapteh awesome! I hadn't dug deeper, but yeah I wouldn't have thought it to be NextJS if it was also not working in Gatsby as well. |
this is a big problem for us at the NYT - can someone take a look? |
Ah i see you already did that, thanks @staylor ! And nyt is a nice implementation :) |
adding now, thank you for all your patience and puzzling stuff! All is working correctly when i look at the actual load on the server. The ssr settings per component are now respected. No extra load. Superb!
|
@senorgeno if you can test with Gatsby that would be awesome. Else i will test it tomorrow with Gatsby so i have a reason to check this Gatsby out :) |
@hwillson @maapteh Yeah that is working for me in Gatsby. Nice work! Just to be sure I have the correct setup I have |
in client: and indeed on component level you can set ssr arguments to false to exclude them from ssr. I think by default they were always ssr true. |
Great. That is what I have, thanks!
…On Thu, Oct 3, 2019 at 4:18 AM Mаартен - Maarten ***@***.***> wrote:
in client:
ssrMode: typeof window === 'undefined', // Disables forceFetch on the
server (so queries are only run once)
and indeed on component level you can set ssr arguments to false to
exclude them from ssr.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3500?email_source=notifications&email_token=AAFR32E2YJ5CP2KVWYS6FC3QMS3UZA5CNFSM4IXFLKB2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAFEAGY#issuecomment-537542683>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAFR32C3KAE4X2WF35URUT3QMS3UZANCNFSM4IXFLKBQ>
.
--
Gene Dower
[email protected]
|
in 3.1.2, 3.1.3 Still having this issue. (3.1.1 is fine) |
I'm having the same issue on 3.1.5. |
It's work for me on 3.1.5. Just make sure you set up the Apollo client correctly. new ApolloClient({
...,
ssrMode: typeof window === "undefined",
}); |
I saw the other issue about ssr (#3130). But that one was closed. Im using @apollo 3.1.0 and it seems the useQuery items with 'ssr: false' are still tried to call the backend. Im using the batched link package to sent all queries at once.
Intended outcome:
When i set ssr: false it should not try to call server when rendering the main part SSR. For ssr: true all works as expected.
Actual outcome:
Call is done twice. I curled the page to be sure no client side code is being executed. Then i see where ssr is set to false it's still being called.
How to reproduce the issue:
I have the following query:
For the parts where ssr is true everything works as expected (only being called once. For ssr false i see its been called twice.
When i now add 'skip: !ssr' i see the 'ssr: false' version are not being called. So that seems to be picked up correctly, but ssr not.
Version
The text was updated successfully, but these errors were encountered: