Skip to content

[Bug] All cookies disappear after refreshing #16

@roseline124

Description

@roseline124

Issue

If I don't set the cookie in the parameters, it will disappear.

If I add this addon to a new project that doesn't have any storybooks, I'll just need to set the cookie for each storybook.

However, if I already have a lot of existing storybooks, it's a pain to set the cookie in parameters for each storybook individually (even if I bind a template, I still have to swap existing storybooks with the template, which is also a pain).

Proposal

Add preserveCookie(Boolean) as an option to the addon, so that if preserveCookie is true, no cookies are lost without setting parameters['cookie'] in each storybook.

If parameters['cookie'] exists in a particular storybook, it will cause existing cookies to be overwritten with the values in the cookie.

  • Example: addons: [{ name: 'storybook-addon-cookie', options: { preserveCookie: true } }, ...] (.storybook/main.ts)
  • The default value of preserveCookie is true.

Contribute

I can contribute!
I've contributed to open source projects like pnpm, typeorm, summernote, etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions