-
Notifications
You must be signed in to change notification settings - Fork 222
Conversation
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.
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 |
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.
If we just used https://www.npmjs.com/package/universal-cookie it would handle updating the cookies for us
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.
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.
fb3aae9
to
f179ebb
Compare
f179ebb
to
ec3ca75
Compare
superseding by #1002 |
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 thereact-network
package.Type of change
react-network
Minor: New feature (non-breaking change which adds functionality)Checklist