question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Docs tab shows 'no code available' when using dynamic title for story

See original GitHub issue

Describe the bug When creating story with dynamic title, story shows no code available.

To Reproduce Steps to reproduce the behaviour:

  1. Create story with dynamic title
  2. Start storybook
  3. See the docs tabs

Expected behaviour Code will be available

Screenshots

image

Code snippets

import React from "react";
import { Button } from "@storybook/react/demo";

const createTitle = title => `a/${title}`;

export default {
  title: createTitle("NokButton"),
  component: Button
};

export const Text = () => <Button>Hello Button</Button>;

System:

  System:
    OS: macOS 10.15.2
    CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
  Binaries:
    Node: 12.13.1 - ~/.nvm/versions/node/v12.13.1/bin/node
    Yarn: 1.21.1 - /usr/local/bin/yarn
    npm: 6.12.1 - ~/.nvm/versions/node/v12.13.1/bin/npm
  Browsers:
    Chrome: 79.0.3945.130
    Firefox: 70.0.1
    Safari: 13.0.4
  npmPackages:
    @storybook/addon-actions: ^5.3.7 => 5.3.7
    @storybook/addon-docs: ^5.3.7 => 5.3.7
    @storybook/addon-links: ^5.3.7 => 5.3.7
    @storybook/addons: ^5.3.7 => 5.3.7
    @storybook/react: ^5.3.7 => 5.3.7

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:8
  • Comments:15 (4 by maintainers)

github_iconTop GitHub Comments

6reactions
DScheglovcommented, Mar 31, 2020

It is still an issue.

The case:

File Structure:

./components/
β”œβ”€β”€ atoms
β”‚   └── Heading
β”‚       β”œβ”€β”€ index.d.ts
β”‚       β”œβ”€β”€ index.js
β”‚       β”œβ”€β”€ index.stories.js
β”‚       └── index.test.js
β”œβ”€β”€ molecules
β”‚   └── FormField
β”‚       β”œβ”€β”€ index.d.ts
β”‚       β”œβ”€β”€ index.js
β”‚       β”œβ”€β”€ index.stories.js
β”‚       └── index.test.js
└── story-names.js

./components/story-names.js:

export const ATOM = name => `1-Atoms/${name}`;
export const MOLECULE = name => `2-Molecules/${name}`;
export const ORGANISM = name => `3-Organisms/${name}`;
export const TEMPLATE = name => `4-Templates/${name}`;
export const PAGE = name => `5-Pages: ${name}`;

./components/atoms/Headings/index.stories.js

import React from "react";
import { ATOM } from "../../story-names";
import Heading from ".";

export default {
	component: Heading,
	title: ATOM("Heading"),
};

// some stories for Heading

The result: image

Fix ./components/atoms/Headings/index.stories.js

// ...imports
export default {
	component: Heading,
	title: "1-Atoms/Heading"
};
// ...stories

The result: image

Please fix it.

Motivation To reduce efforts required to keep stories in specific structure the story names are generated with functions.

3reactions
stale[bot]commented, Mar 31, 2020

Hi everyone! Seems like there hasn’t been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don’t have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

ArgsTable - Storybook - JS.ORG
These tables list the arguments (args for short) of the component, and even integrate with controls to allow you to change the args...
Read more >
Using parameters in titles and descriptions in Amazon ...
When you create parameters in Amazon QuickSight, you can use them in titles and descriptions throughout your charts and analyses to dynamically display...
Read more >
About FCM messages | Firebase Cloud Messaging - Google
Firebase Cloud Messaging (FCM) offers a broad range of messaging options and capabilities. The information in this page is intended to help you...
Read more >
Publishing Markup - MATLAB & Simulink - MathWorks
Adding markup allows you to format the published documents and display ... you are not using the MATLAB Editor, or if you do...
Read more >
Exploring data in Looker | Google Cloud
Learn to build queries, display results, and discover insights in Looker. ... Fields tab, from Search results, or from the In Use tab...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found