hwookim / storybook-addon-cookie

Set document.cookie for each Storybook.
MIT License
9 stars 3 forks source link

| gets html encoded to %7C #8

Closed thrownblown closed 10 months ago

thrownblown commented 10 months ago

In version 3.0.1 the cookie config below in Component.stories.tsx:

Primary.parameters = {
  // Set the viewports in Chromatic at a story level.
  layout: "fullscreen",
  chromatic: { viewports: [375, 834, 1200], delay: 3000 },
  cookie: {
    geo: "96094|WEED|CA|US",
  },
  mockData: [...

the cookie string in Storybook results:

document.cookie
'geo="96094|WEED|CA|US"'

in version 3.0.2:

document.cookie
'geo=96094%7CWEED%7CCA%7CUS'
hwookim commented 10 months ago

When writing and reading cookies, it is recommended to encode them via the encodeURIComponent function, so i updated that on v3.0.2. I think it was a bad update to provide this in the library.

In version v3.0.3, I removed the logic around encoding. Thanks for opening the issue.