-
Notifications
You must be signed in to change notification settings - Fork 26
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
add "async mode" to getCloudflareContext
#372
Conversation
add a new option to `getCloudflareContext` that makes it run in "async mode", the difference being that the returned value is a promise of the Cloudflare context instead of the context itself The main of this is that it allows the function to also run during SSG (since the missing context can be created on demand).
🦋 Changeset detectedLatest commit: 621718e The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
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.
Added a few inline comments.
I'll take more time to review more closely tomorrow
Co-authored-by: Victor Berchet <[email protected]>
Co-authored-by: Victor Berchet <[email protected]>
Co-authored-by: Victor Berchet <[email protected]>
Co-authored-by: Victor Berchet <[email protected]>
@vicb sorry I had to update the logic in PS: ideally all the different error cases of this (and their error messages) should be tested, for that we would need an extra app that doesn't set |
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.
LGTM
4e509bc
to
30683e7
Compare
…ync` and `getCloudflareContextAsync`
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.
Maybe:
const InitOpenNextCloudflareForDevErrorMsg =`...`;
...
throw new Error(InitOpenNextCloudflareForDevErrorMsg);
add a new option to
getCloudflareContext
that makes it run in "async mode", the difference being that the returned value is a promise of the Cloudflare context instead of the context itselfThe main of this is that it allows the function to also run during SSG (since the missing context can be created on demand).
Closes #371
Docs PR: opennextjs/docs#75