hwookim / storybook-addon-cookie

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

is there a way to preserve existing cookies when using this plugin? #9

Closed elirov closed 8 months ago

elirov commented 10 months ago

export const story1: Story = { parameters: { cookie: { brand: 'MYBRAND', }, ....

ends up clearing out all the existing cookies and only ending up with the brand cookie. Is there a way to just append the cookies to the browser's cookie list without clearing the existing cookies?

hwookim commented 8 months ago

I apologize for the very long delay in responding. The cookiePreserve option in version 3.2.0 should accomplish what you're looking for.

Basically, this library was developed to have independent cookies for each story, so leaving existing cookies is likely to have a different result than the original purpose.

So, by default, I'll keep things the way they are. Instead, I've changed it to preserve existing cookies if the cookiePreserve option is true.

Thanks for the great issue!