Skip to content

Conversation

@jmortlock
Copy link

@jmortlock jmortlock commented Dec 19, 2025

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

  • Added unit tests
  • Using this patch on my own servers

Docs

Will need to update https://docs.astro.build/en/reference/api-reference/#cookies

/cc @withastro/maintainers-docs for feedback!

@changeset-bot
Copy link

changeset-bot bot commented Dec 19, 2025

🦋 Changeset detected

Latest 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

@github-actions github-actions bot added pkg: integration Related to any renderer integration (scope) pkg: astro Related to the core `astro` package (scope) labels Dec 19, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Dec 19, 2025

Merging this PR will not alter performance

✅ 9 untouched benchmarks


Comparing jmortlock:support-partitioned-cookies (ebd311a) with main (37ab65a)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (7f449b7) during the generation of this report, so 37ab65a was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@@ -0,0 +1,5 @@
---
'astro': patch
Copy link
Member

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!

Suggested change
'astro': patch
'astro': minor

Copy link
Member

@Princesseuh Princesseuh left a 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!

@Princesseuh Princesseuh added this to the 5.17.0 milestone Jan 13, 2026
Copy link
Member

@sarah11918 sarah11918 left a 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
Copy link
Member

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!)

Suggested change
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)

@sarah11918
Copy link
Member

(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!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: astro Related to the core `astro` package (scope) pkg: integration Related to any renderer integration (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants