Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Next.js example #282

Closed
fev4 opened this issue Dec 4, 2019 · 6 comments
Closed

Next.js example #282

fev4 opened this issue Dec 4, 2019 · 6 comments
Labels
enhancement New feature or request

Comments

@fev4
Copy link

fev4 commented Dec 4, 2019

Feature Request

Is your feature request related to a problem? Please describe.
Not a current problem per se. Mainly looking for information/exemplification.

Describe the solution you'd like
Mainly I'd like to know how Offix would integrate with Next.js under the Zeit Now 2.0 serverless paradigm. This is because I've been looking for different options to make the queries/mutations from the combination of these two examples with-apollo and with-graphql-faunadb, to no avail.

Looked into apollo-cache-persist but found this issue, so I stopped there before trying it.

Is there a chance for an example such as this?

Thank you

@wtrocki
Copy link
Contributor

wtrocki commented Dec 4, 2019

Currently, offix is using a similar concept as apollo-cache-perist where queries need to technically happens. Obviously there can be some layer of service workers available here but then we also do not need expensive offline support as modifications happen on server. I do think that we will need to know more about the case as it is currently hard to get how this even potentially would work.

@wtrocki wtrocki added the enhancement New feature or request label Dec 4, 2019
@wtrocki
Copy link
Contributor

wtrocki commented Dec 11, 2019

I have done some reading and in fact this is pretty much doable and documented in Apollo. Server sets initial state for cache and storage should handle it nicely. We will look how we can enable this feature but this is definitely not going to land to the next offix release.

@fev4
Copy link
Author

fev4 commented Dec 11, 2019

This is great! Thank you, looking forward to it.

@ldrv565
Copy link

ldrv565 commented Mar 13, 2020

const { ApolloOfflineClient } = process.browser ? require('offix-client') : {};

@ldrv565
Copy link

ldrv565 commented Mar 18, 2020

maybe you should write something like this:
exports.isMobileCordova = function() {
if (process.browser || typeof window !== 'undefined') {
return !!window['cordova'];
}
return false;
};

instead:
exports.isMobileCordova = function () {
return window && !!window["cordova"];
};

@kingsleyzissou
Copy link
Contributor

Since a workaround has been shown, we will be closing this issue. Since the primary use-case for Offix is to provide offline support, this would be difficult to implement into a next.js since this is being rendered from the server and would require a few workarounds to disable Offix, while offline.

Thanks for your feedback!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants