Replies: 4 comments 3 replies
-
Looks like all cookies are expected to be return JSON.parse(decodeURIComponent(myEscape(atob(value)))); will throw. Perhaps we should check if the cookie contains something that resembles JSON? Cookies often contain strings, or encoded tokens/etc. |
Beta Was this translation helpful? Give feedback.
-
I'm going to convert this to a Proposal since it's a feature request - Remix cookies today are JSON objects so they're a bit easier to store multiple pieces of information in. I think you have 2 options at the moment:
|
Beta Was this translation helpful? Give feedback.
-
@brophdawg11 I'm sure I missed the part where Remix cookies differed from just regular cookies. Since I don't have control over all the various cookies set/read by my org, I went with the first option. I probably should have understood that If this is the plan going forward, I'm sure some docs about working with existing cookies is sufficient. |
Beta Was this translation helpful? Give feedback.
-
Hello! Faced the same problem while implementing i18next support with detection of language from cookies, and the current workaround is:
It's worth to mention, that decode function being executed for every cookie value. If you have multiple values, you need to check type of value, to make sure you are using correct cookie. |
Beta Was this translation helpful? Give feedback.
-
What version of Remix are you using?
2.2.0
Are all your remix dependencies & dev-dependencies using the same version?
Steps to Reproduce
I've created the following cookie:
When attempting to parse it and pull a value from it, I get
null
.I can see via that first console log (of all Cookie headers) that the cookie is indeed in the header:
DEBUGPRINT[2]: upsell.tsx:17: cookieHeader= PGADMIN_LANGUAGE=en;
Expected Behavior
I expect that second console.log (of the parsed cookie) to log
en
.Actual Behavior
It logs
null
.The same is true for any cookie I try to log. They all show up in
request.headers.get('Cookie');
, but all parse tonull
;Perhaps some weird async thing? My loader is async, I am awaiting the parse.
Beta Was this translation helpful? Give feedback.
All reactions