#Is it possible to get storybook to open in an existing tab instead of always using a new one?

1 messages · Page 1 of 1 (latest)

wheat thicket
#

I'm sure this must have been asked before but the Discord search is terrible and I can't find it.

I often restart my storybook server and as a result I have a lot of storybook tabs open on my machine at once. I know a few of my other devs have this issue too. I am aware I can add --no-open in the CLI but this isn't actually something I'd want to have to remember to do. Is it possible to configure Storybook to only open a new browser tab if there isn't one open already?

native pollen
#

We already do everything we can to do this, we use a library that supposedly does this, however:

  • this only works on MacOS
  • it uses appleScript
  • it's effectively a bit of a security issue
  • It doesn't work for all browsers

Normally applications are isolated from each other. 1 application might make a request together, but no direct control.

Browsers (for privacy and security reasons) do not allow other applications to ask which tabs are open, or give the ability to change the URL of 1 of the tabs.

So the script that makes this happen makes use of a loophole, where the OS automation tool (which has access to all sorts of things to be able to automate user's tasks) effectively acts on the user's behalf and searches for the right tab and forces it to refresh.

This is incredibly convenient, I know.
But it has it's caveats.

I think the combo that is supposed to work is MacOS + Chrome.

If you don't want storybook to open the page at all (and manually refresh) add --ci flag to the command.