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

Remove session #5946

Merged
merged 5 commits into from
Aug 17, 2022
Merged

Remove session #5946

merged 5 commits into from
Aug 17, 2022

Conversation

Rich-Harris
Copy link
Member

@Rich-Harris Rich-Harris commented Aug 16, 2022

Implements #5883. This removes event.session from load, the session store, and getSession. It's easy to use event.locals in handle along with +layout.server.js/+page.server.js to provide equivalent functionality.

Closes #4426.

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. All changesets should be patch until SvelteKit 1.0

@changeset-bot
Copy link

changeset-bot bot commented Aug 16, 2022

🦋 Changeset detected

Latest commit: e45159b

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

This PR includes changesets to release 1 package
Name Type
@sveltejs/kit Patch

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

@rmunn
Copy link
Contributor

rmunn commented Aug 17, 2022

I've closed two issues as moot now that session is gone:

A quick issue search on the word "session" turned up a lot of issues that mention that word, but only those two seemed to be specifically about the special session store that has just been removed. If this PR is reverted in the near future, we can reopen those issues.

@PH4NTOMiki
Copy link
Contributor

What about SPA? This was a really bad move

@MathiasWP
Copy link
Contributor

What about SPA? This was a really bad move

If you application is SPA only, then you should be able to achieve the same behaviour by creating your own store and calling it "session" 👍

@Rich-Harris
Copy link
Member Author

If you have access to a server, then you can return the equivalent of session data from a +layout.server.js. If you don't, then you couldn't return session anyway.

@bjon
Copy link
Contributor

bjon commented Aug 17, 2022

@Rich-Harris How do I get the data from +layout.server.js, in +layout.js? await parent() is empty in +layout.js.

@dummdidumm
Copy link
Member

https://kit.svelte.dev/docs/load#input-properties-data

@bjon
Copy link
Contributor

bjon commented Aug 17, 2022

@dummdidumm Thanks a lot! Didn't even know that data prop existed. 👍🏻

@fcrozatier fcrozatier mentioned this pull request Aug 23, 2022
EstebanBorai added a commit to EstebanBorai/next-auth that referenced this pull request Feb 1, 2024
Replaces `getSession` with `auth` given that `getSession` is
now deprecated.

Refer to: sveltejs/kit#5883 for context.

The following PR also serves as context for the same
milestone: sveltejs/kit#5946
balazsorban44 pushed a commit to nextauthjs/next-auth that referenced this pull request Feb 4, 2024
fix: use `auth` over `getSession`

Replaces `getSession` with `auth` given that `getSession` is
now deprecated.

Refer to: sveltejs/kit#5883 for context.

The following PR also serves as context for the same
milestone: sveltejs/kit#5946
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Navigating from prerendered page to non-prerendered page does not trigger hooks
7 participants