Skip to content
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

Make Amplify datastore Nextjs friendly #4990

Closed
mdegrees opened this issue Feb 27, 2020 · 3 comments
Closed

Make Amplify datastore Nextjs friendly #4990

mdegrees opened this issue Feb 27, 2020 · 3 comments
Assignees
Labels
feature-request Request a new feature

Comments

@mdegrees
Copy link

Is your feature request related to a problem? Please describe.
Making an SSR page using Nextjs implies getting the initial state server side using getInitialProps helper function. With Amplify dataStore there seems to be no way to get the initial app state server side.

Describe the solution you'd like
Ideally being able to call datastore.query inside getInitialProps (server side).

Additional context
From Amplify datastore documentation it says :

The Sync Engine will run a GraphQL query on first start that hydrates the Storage Engine from the network using a Base Query.

Maybe make use of what @dabit3 did with AppSync https://github.com/dabit3/next-apollo-appsync/blob/master/src/withData.js

@mdegrees mdegrees added the feature-request Request a new feature label Feb 27, 2020
@simpleshadow
Copy link

See #1613.

@ericclemmons
Copy link
Contributor

This has been addressed as part of #6146!

Please see my synopsis on changes here: #5435 (comment)

Internally, DataStore won't run the sync engine when on the server: instead it will get all the data it needs to satisfy DataStore.query(...) and return it. No subscriptions needed :)

@github-actions
Copy link

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels or Discussions for those types of questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request a new feature
Projects
None yet
Development

No branches or pull requests

3 participants