Skip to content

[Bug]: Storybook goes into white screen if code fails in the Manager UIΒ #32968

@yannbf

Description

@yannbf

Describe the bug

When code in the Storybook Manager UI breaks, such as: foo.bar = 10 where foo is undefined, Storybook crashes completely into a white screen. This has happened a few times in different places in Storybook, most recently (though already fixed) when registering new shortcuts on MacOS and using special characters.

The experience of the crash is the following:
Image

The ideal solution has to be discussed with the team, we should add a global error boundary and provide a helpful error UI (perhaps notifications, similar to VSCode?)

Reproduction link

Reproduction steps

An easy way to reproduce this error is by using a custom .storybook/manager.ts file with code that will break, e.g.:

import { addons, type State } from 'storybook/manager-api'

addons.setConfig({
  layoutCustomisations: {
    showToolbar(state: State, defaultValue: boolean) {
      if (state.storyId?.includes('button')) {
        throw new Error('Boom')
      }

      return true
    },
  },
})

System

-

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    affects demosbuginternal-qaThis issue was reported by the Storybook team, potentially on unreleased or prerelease software.ui

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions