-
Notifications
You must be signed in to change notification settings - Fork 82
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
feat: Add getInitialSessionAuthContext to compute SessionAuth context #785
feat: Add getInitialSessionAuthContext to compute SessionAuth context #785
Conversation
✅ Deploy Preview for astounding-pegasus-21c111 canceled.
|
✅ Deploy Preview for precious-marshmallow-968a81 canceled.
|
isContextFromSSR: true; | ||
loading: false; |
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.
These should not be required since they are static values.
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.
But they are expected by supertokens-auth-react
, if they will be optional - that means we would have to polyfill them inside SessionAuth
component, and in that case I would rather remove them completely from supertokens-node
@@ -230,6 +230,24 @@ export default class NextJS { | |||
return result; | |||
} | |||
|
|||
static async getInitialSessionAuthContext(session: SessionContainer | undefined): Promise<SSRSessionContextType> { |
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.
I don't think we need this function. And if we are going to keep it, why is it in the nextjs file?
Summary of change
Adds
getInitialSessionAuthContext
to support computing initialSessionAuth
context (to be used withinitialSessionAuthContext
property from supertokens/supertokens-auth-react#789)Related issues
Test Plan
Tested locally on a NextJS implementation using supertokens.
getInitialSessionAuthContext(session)
creates an SSR session context that works like expected when passed intoinitialSessionAuthContext={}
of<SessionAuth />
component. Also covered by unit testsDocumentation changes
TODO.
(If relevant, please create a PR in our docs repo, or create a checklist here highlighting the necessary changes)
Checklist for important updates
coreDriverInterfaceSupported.json
file has been updated (if needed)lib/ts/version.ts
frontendDriverInterfaceSupported.json
file has been updated (if needed)package.json
package-lock.json
lib/ts/version.ts
npm run build-pretty
recipe/thirdparty/providers/configUtils.ts
file,createProvider
function.git tag
) in the formatvX.Y.Z
, and then find the latest branch (git branch --all
) whoseX.Y
is greater than the latest released tag.add-ts-no-check.js
file to include thatsomeFunc: function () {..}
).Remaining TODOs for this PR