Loading in Storybook always displays the error: "Expecting an HTML snippet or DOM node from the story"

Created on 26 October 2022, about 2 years ago
Updated 4 June 2023, over 1 year ago

Problem/Motivation

I've followed the documentation for getting this setup and completed all steps, but I think I'm missing some information to get it to work.

After completing the install instructions and starting Storybook, each of the example components returns the red/black with an error message like: Expecting an HTML snippet or DOM node from the story: "2. No Image" of "CL Components/Examples/Banner".

Steps to reproduce

Follow the docs located here: https://git.drupalcode.org/project/cl_server/-/blob/1.x/docs/storybook.md

In `.storybook/main.js` add the path so that Storybook can find the components provided by the example module:

  "stories": [
    "../stories/**/*.stories.mdx",
    "../stories/**/*.stories.@(json)",
    "../../../../modules/**/*.stories.yml"
  ],

In `.storybook/preview.js` set the server path to local development URL:

  server: {
    url: 'http://docker.test',
  },

Start storybook and visit any of the example components and see an error message.

Related confusion about the setup
If I'm setting the path to the stories file in `main.js` so that Storybook looks directly to that yml file, what is cl_server even doing? I see it's providing a route at path `/_cl_server` and the render method there accepts arguments that prepare a render array of components. This makes me believe that Storybook should actually be consuming that path but I don't know where that connection would happen nor what the full path to a component at `_cl_server/...` would look like.

Proposed resolution

In addition to helping figure out the cause of the error, maybe the documentation can be updated to explain more about how cl_server is actually working in relation to Storybook so it's easier to debug individual issues.

πŸ’¬ Support request
Status

Postponed: needs info

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States jascote

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024