Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

Universal Cookies #935

Closed
wants to merge 8 commits into from
Closed

Universal Cookies #935

wants to merge 8 commits into from

Conversation

cartogram
Copy link
Contributor

@cartogram cartogram commented Aug 30, 2019

Description

This PR adds logic around setting and getting cookies to react-network.

Question: Should we have a separate package for this (@shopify/universal-cookies)? At first I felt like cookies fell into the "network" side of things, but on the other hand, they also live in the browser.

I also need to figure out a way to keep the cookie headers on the server in sync with changes (see comment here. One way I was thinking would be that there is a way to attach a change watcher on the cookies during the applyToContext step. The cookies setter would then call the watcher every time cookies change. This pushes me further in the direction of this being outside of the react-network package.

Type of change

  • react-network Minor: New feature (non-breaking change which adds functionality)

Checklist

  • I have added a changelog entry, prefixed by the type of change noted above

@cartogram cartogram closed this Aug 30, 2019
@cartogram cartogram reopened this Aug 30, 2019
@cartogram cartogram changed the title Universal Cookies [WIP] Universal Cookies Aug 30, 2019
@cartogram cartogram changed the title [WIP] Universal Cookies Universal Cookies Aug 30, 2019
Copy link
Contributor

@marutypes marutypes left a comment

Choose a reason for hiding this comment

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

I don't hate the idea of handling cookies holistically from in this package, but I'd rather we leveraged https://www.npmjs.com/package/universal-cookie / https://www.npmjs.com/package/universal-cookie-koa like we do in web rather than rebuilding it's functionality.

}

// eslint-disable-next-line no-warning-comments
// TODO: Add a watcher function that reapplies the cookies
Copy link
Contributor

Choose a reason for hiding this comment

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

If we just used https://www.npmjs.com/package/universal-cookie it would handle updating the cookies for us

Copy link
Member

@lemonmade lemonmade left a comment

Choose a reason for hiding this comment

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

I agree with Mat, I think we should just build on top of universal-cookies for this, hopefully with a nice hook-ey API if possible.

@cartogram
Copy link
Contributor Author

cartogram commented Sep 16, 2019

superseding by #1002

@cartogram cartogram closed this Sep 16, 2019
@BPScott BPScott deleted the universal-cookies branch May 22, 2021 00:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants