storybook: @storybook/addon-backgrounds@next does not work

Describe the bug I’m trying to use storybook@next. After I installed & set @storybook/addon-background, I faced two problems.

  1. Background tool is not displayed occasionally.
  2. When I tried to set a background (by clicking a color button), it emits the following error.
    TypeError: _this.tooltipRef.current.scheduleHide is not a function
    

To Reproduce

  1. git clone https://github.com/Ailrun/storybook-issue5416
  2. npm i
  3. npm start
  4. Check that there is no background tool just like the screenshot. image
  5. (While running npm start) uncomment line 5-21 of index.js. (FYI, I already set the global parameters in .storybook/config.js)
  6. Check that there is a background tool. (Weirdly…)
  7. Open the web dev tool.
  8. Click the background tool button.
  9. Select grey (or any other colors).
  10. See the error.

Expected behavior Always display the tool, and do not emit any errors.

Screenshots image

System:

  • OS: Manjaro (Kernel 4.18)
  • Device: Desktop
  • Browser: Firefox 64
  • Framework: React
  • Addons: Backgrounds
  • Version: 5.0.0-alpha.10

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 16 (16 by maintainers)

Most upvoted comments

Oh, I notice that it is already fixed in the commit 4687253! It was just not yet released. I will check the lastest version 😃 I think it will work.

Thank you for all your endeavors to make storybook better!

@ailrun - AFAICT the addon is working. Here is the latest version build of our storybook: https://next--storybooks-official.netlify.com/?path=/story/addons-backgrounds--story-1

You can try yourself with the @storybook/react@next (5.0.0-beta.1) release. Let us know if it is not fixed.

I think @ndelangen has been thinking about this stuff. I would suggest that these addons should be listening to the SET_CURRENT_STORY event or perhaps the STORY_RENDERED event?