Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to switch theme back to "light" #6798

Closed
domyen opened this issue May 16, 2019 · 12 comments
Closed

Unable to switch theme back to "light" #6798

domyen opened this issue May 16, 2019 · 12 comments

Comments

@domyen
Copy link
Member

domyen commented May 16, 2019

Describe the bug
I'm unable to switch the theme back to "light" after using the dark theme. The only resolution is the localstorage.clear() hack.

To Reproduce
Steps to reproduce the behavior:

  1. Clone the Storybook Design System project.
  2. Go to SB config.js and import { themes } from '@storybook/theming';
  3. Set options: { theme: themes.dark } to show the dark theme
  4. Comment out above and refresh. It shows dark theme (but should go back to light). And when I set it manually to themes.light it does not refresh either.

Expected behavior
When I do not set a theme it should reset the theme.

Screenshots
Here's a 📹video of this behavior.

System:

  • OS: Mac OS
  • Device: Macbook Pro 2018
  • Browser: Chrome, safari
  • Framework: React
  • Version: 5.2.x
@shilman shilman added this to the 5.1.0 milestone May 16, 2019
@Saifadin
Copy link

Happens for me too. The only difference is, that I work on a React based Storybook, that has the dark theme and i also use an HTML based Storybook. When switching between them, only localStorage.clear works and i loose all other customisations i made to my storybook.

@ndelangen
Copy link
Member

@Saifadin one recommendation I can give right now, is to not have the 2 storybooks share the same port.

I'll implement #6806 (hopefully soon), which will remove the need to cache the theme in localStorage all-together.

@shilman shilman modified the milestones: 5.1.0, 5.1.x Jun 5, 2019
@stale
Copy link

stale bot commented Jun 26, 2019

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label Jun 26, 2019
@stale
Copy link

stale bot commented Jul 26, 2019

Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook!

@stale stale bot closed this as completed Jul 26, 2019
@patrick-radulian
Copy link

patrick-radulian commented Dec 4, 2019

Is there any update on this issue? I looked into theming a react storybook and followed the documentation / tutorial, using the dark theme at first.
To explore possibilities I then created a custom theme and then tried to revert that before implementing more serious theme changes - that's when it broke for me as well, keeping parts of the light theme, parts of the dark theme and parts of my placeholder-custom-theme.

Storybook version: 5.3.0-beta.14

@shilman
Copy link
Member

shilman commented Dec 4, 2019

@patrick-radulian yes there's been an update here.

@ndelangen has updated the recommended theming API here:

https://github.com/storybookjs/storybook/blob/next/docs/src/pages/configurations/theming/index.md#global-theming

I don't know if this will fix the issue directly, or whether it's part of a longer-term breaking change that won't be usable until 6.0. In the meantime, the workaround is to run on different ports. @ndelangen can yo comment?

@ndelangen
Copy link
Member

I removed the code that persists the theme, because the FOUC should no longer happen.

@ndelangen
Copy link
Member

@patricklafrance woulds you be able to review/test?

@patrick-radulian
Copy link

Sorry for the late reply

I've updated to storybook 5.3.0-beta.25 (could not updated to beta.30 because of a problem with peer-dependencies right now, as it seems) but the situation is still the same.
Changing the theme in the options parameter requires localStorage.clear() to be recodnized.

The same thing is going on with other options apparently - I've tried playing with the panelPosition option, setting it to right and back to bottom - also this is only updated after clearing the localStorage.

@shubhamholkar007
Copy link

is there any simple option than creating new simple theme ?

@shilman shilman reopened this Mar 11, 2020
@stale stale bot removed the inactive label Mar 11, 2020
@shilman
Copy link
Member

shilman commented Mar 11, 2020

This is getting fixed in #9076 which will hopefully be merged/released soon.

@shilman
Copy link
Member

shilman commented Mar 23, 2020

Yowza!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.0.0-alpha.28 containing PR #9076 that references this issue. Upgrade today to try it out!

You can find this prerelease on the @next NPM tag.

Closing this issue. Please re-open if you think there's still more to do.

@shilman shilman closed this as completed Mar 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants