-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Support partitioned cookies #15063
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
base: main
Are you sure you want to change the base?
Support partitioned cookies #15063
Conversation
🦋 Changeset detectedLatest commit: ebd311a The changes in this PR will be included in the next version bump. 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 |
.changeset/nine-olives-drop.md
Outdated
| @@ -0,0 +1,5 @@ | |||
| --- | |||
| 'astro': patch | |||
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.
This will need to be a minor, unfortunately!
| 'astro': patch | |
| 'astro': minor |
Princesseuh
left a comment
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.
Looks great, thank you very much!
sarah11918
left a comment
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.
Thank you for this cool feature @jmortlock ! This sounds like a great option to have.
I've left a comment below as an example to help you create our typical changeset to help promote the feature and make sure people understand what it is, and see how they can use it in their project right away.
As for documentation, you're right that we'll want a new API reference entry at https://docs.astro.build/en/reference/api-reference/#astrocookiesetoptions in a separate PR to the docs repo. (https://github.com/withastro/docs) You can follow the existing model there, but note that you'll also need to add a <Since /> component to show that this was added at a later date than the other options. You can find contributing docs for our API reference format (including yes, that weird blank line 😅 at https://contribute.docs.astro.build/reference/api-references/ if you need to check anything!)
| 'astro': minor | ||
| --- | ||
|
|
||
| Updates the `AstroCookieSetOptions` type exported from `astro` to allow partitioned cookies |
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.
Lucky you, this is a minor feature so... that means time to hype! 🥳
For a minor release of a new feature, we'd usually hype it up a bit more, focusing on what a user can now do (with an example usage shown) rather than implementation details. You can see a model of this in our contributing docs:
- Quick sentence to shout "New! Shiny!" and grab people's attention without a lot of visual clutter
- describe the problem it solves or ability it unlocks and why that's cool
- show an example that people could copy into their projects right away to try it out so that it's easy for them to get started
- link to the docs for the new thing
So maybe something like... (just rough wording to get the idea of the structure across!)
| Updates the `AstroCookieSetOptions` type exported from `astro` to allow partitioned cookies | |
| Adds a new `partition` option that can be passed when setting a cookie to allow creating partitioned cookies | |
| [Partitioned cookies](https://developer.mozilla.org/en-US/docs/Web/Privacy/Guides/Privacy_sandbox/Partitioned_cookies) can only be read within the context of the top-level site they were set on. This allows cross-site tracking to be blocked, while still enabling legitimate uses of third-party cookies. | |
| You can create a partitioned cookie by passing `partition` when setting the cookie: | |
| ``` | |
| // a code example of what this would look like in Astro code | |
| ``` | |
| For more information, see the [`AstroCookieSetOptions` API reference](https://docs.astro.build/en/reference/api-reference/#astrocookiesetoptions) |
|
(It's only been a few days so no rush, but just a reminder that there's a Docs PR required for this PR, and a changeset comment to address!) |
Changes
Allows creation of partitioned cookies, https://developer.mozilla.org/en-US/docs/Web/Privacy/Guides/Privacy_sandbox/Partitioned_cookies.
This is provided in the underlying library:
https://github.com/jshttp/cookie?tab=readme-ov-file#partitioned
Testing
Docs
Will need to update https://docs.astro.build/en/reference/api-reference/#cookies
/cc @withastro/maintainers-docs for feedback!