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

Maintain session info on new contexts #4453

Merged
merged 1 commit into from
Dec 1, 2020

Conversation

timleslie
Copy link
Contributor

This PR changes the behaviour of context.createContext in a fairly fundamental way: It now carries forwards the parameters that were used to create the original context object. This matches the behaviour we currently have implemented in the core createContext() function. This results in what is arguably the "expected" behaviour, if you do:

newContext = context.createContext({ skipAccessControl: true })

you will get a new context object which has the same session information as the original context. In the much less common case of this not being what you want you can always do:

newContext = context.createContext({ sessionContext: {}, skipAccessControl: true })

I think changing the behaviour of createContext is a nicer solution that the cloneContext function proposed in #4425.

@changeset-bot
Copy link

changeset-bot bot commented Dec 1, 2020

🦋 Changeset detected

Latest commit: 1ee0ee6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
@keystone-next/keystone Major
@keystone-next/example-auth Patch
@keystone-next/app-basic Patch
@keystone-next/example-ecommerce Patch
@keystone-next/example-roles Patch
@keystone-next/example-todo Patch
@keystone-next/admin-ui Patch
@keystone-next/auth Major

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

Copy link
Member

@JedWatson JedWatson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I'm convinced 👍

@timleslie timleslie force-pushed the create-context-maintains-session branch from 948a2a7 to 1ee0ee6 Compare December 1, 2020 21:19
@timleslie timleslie merged commit c89b43d into master Dec 1, 2020
@timleslie timleslie deleted the create-context-maintains-session branch December 1, 2020 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants