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

SB5 Theming breaks React 15 compat #6474

Closed
2 tasks
shilman opened this issue Apr 10, 2019 · 8 comments
Closed
2 tasks

SB5 Theming breaks React 15 compat #6474

shilman opened this issue Apr 10, 2019 · 8 comments
Assignees
Milestone

Comments

@shilman
Copy link
Member

shilman commented Apr 10, 2019

The problem

Currently theming operates in config.js which is "preview" code (user code). It requires Emotion, which in turn requires React 16.3+.

In 5.0.x the workaround is to not theme Storybook.

This breaks in 5.1.x, probably due to #6435

I've created an example and added it to the repo so we can discuss around it, and also to make sure we don't inadvertently break back-compat in the future. Coming in a PR shortly.

The solution

Allow users to configure the manager separately from the preview, as relates to #4796 #4995

  • split out create into its own file
  • update documentation
@tmeasday
Copy link
Member

tmeasday commented Apr 10, 2019

There is another solution which I suggested somewhere else and which seems to have dropped off the map: rearrange @storybook/theming so the bit that you import for config.js doesn't import from emotion.

This doesn't seem at all hard to do, I had just asked @ndelangen some question about the animation stuff but he hadn't responded. I can take a look at it if we clear that up (that's the file that imports emotion and I'm pretty sure its only needed manager-side)

@ndelangen
Copy link
Member

Should be fixed in this PR:
#6475

@ndelangen
Copy link
Member

Thanks for the repro branch @shilman !

@shilman
Copy link
Member Author

shilman commented May 8, 2019

Yowza!! I just released https://github.com/storybooks/storybook/releases/tag/v5.1.0-alpha.40 containing PR #6475 that references this issue. Upgrade today to try it out!

Because it's a pre-release you can find it 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 May 8, 2019
@natocTo
Copy link

natocTo commented May 8, 2019

I have tried it and still get same error.

TypeError: Object(...) is not a function

problem is here: (core.browser.esm.js)

var EmotionCacheContext = createContext(createCache());

There is problem with two versions of React. I use React 15 and Emotion use React 16. Import createContext from React 15 is resolved as undefined so it can not be call as function.

@mundosk8
Copy link

Im facing the same problem also. Even using the next tag

@shilman shilman reopened this May 13, 2019
@ndelangen
Copy link
Member

@shilman do you know how to reproduce this?

@shilman shilman modified the milestones: 5.1.0, 5.1.x Jun 5, 2019
@shilman shilman assigned shilman and unassigned ndelangen Jul 2, 2019
@shilman
Copy link
Member Author

shilman commented Aug 27, 2019

This issue seems like it hasn't gotten much action lately. Closing, please shout if you're still stuck on this!

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

5 participants