next-with-apollo icon indicating copy to clipboard operation
next-with-apollo copied to clipboard

Option to use `getDataFromTree` also on client?

Open borekb opened this issue 4 years ago • 3 comments

Currently, getDataFromTree works only during SSR due to this condition:

https://github.com/lfades/next-with-apollo/blob/e0ddc5a628e33d4bac6e877dc2240e02e3a101a9/src/withApollo.tsx#L69

On the client, you'll see "Loading..." due to this, which is not bad but an alternative UX that we actually prefer is to wait for all data to load and only then change the route, sort of like with turbolinks.

To achieve that, we maintain a fork of with-apollo but that is own drawbacks, obviously. Would this project consider accepting a PR that would make this configurable, like this?

export default withApollo(Index, { getDataFromTree, useGetDataFromTreeAlsoOnClient: true });

(Naming it will be challenging 😄.)

borekb avatar Jul 28 '20 20:07 borekb

Hey, can I get access to the fork repo. This issue is just annnoying.

Faisal-Manzer avatar Nov 05 '20 18:11 Faisal-Manzer

Before this can work this Next.js issue will need to be fixed: https://github.com/vercel/next.js/issues/10126 / https://github.com/vercel/next.js/issues/9336

Maybe clientPrepass: true? It should be something short anyways 😄

zenflow avatar Mar 30 '21 01:03 zenflow

clientSidePreload: true

zenflow avatar Apr 01 '21 20:04 zenflow