Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request for SetStories method to accept StoriesHash input #16996

Closed
ooihuiying opened this issue Dec 13, 2021 · 2 comments
Closed

Request for SetStories method to accept StoriesHash input #16996

ooihuiying opened this issue Dec 13, 2021 · 2 comments

Comments

@ooihuiying
Copy link

Is your feature request related to a problem? Please describe
A clear and concise description of the problem. E.g. I'm always frustrated when [...]
I want to use the method setStories provided by const storybookApi = useStorybookApi(); from "@storybook/api" to control what stories show up in the sidebar of my storybook.
However, the input of setStories is of type StoriesRaw as seen in the implementation below:

setStories: async (input, error) => {
      // Now create storiesHash by reordering the above by group
      const hash = transformStoriesRawToStoriesHash(input, {
        provider,
      });

      await store.setState({
        storiesHash: hash,
        storiesConfigured: true,
        storiesFailed: error,
      });
    }

This results in an error when my input is of type StoriesHash and the function attempts to convert it to StoriesHash.

From the api, i don't see any method that allows me to retrieve stories in the type of StoriesRaw and this renders me helpless in calling the above method.

Reference: https://github.com/storybookjs/storybook/blob/main/lib/api/src/modules/stories.ts#:~:text=%7D%2C-,setStories%3A,-async%20(input%2C%20error

Describe the solution you'd like
What would you like to see added to Storybook to solve problem?

I would like to see another function being created for setStories in which in the input is of type StoriesHash instead of StoriesRaw and the implementation skips this method call transformStoriesRawToStoriesHash.

setStories: async (input, error) => {
  
      await store.setState({
        storiesHash: hash,
        storiesConfigured: true,
        storiesFailed: error,
      });
    }

Describe alternatives you've considered
Any alternative solutions or features you've considered.

Are you able to assist to bring the feature to reality?
no | yes, I can...

Yes. I believe the fix is just to add another method below. Correct me if i am wrong?

Additional context
Add any other context or screenshots about the feature request here.

@stale
Copy link

stale bot commented Jan 9, 2022

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!

@stale stale bot added the inactive label Jan 9, 2022
@shilman
Copy link
Member

shilman commented Jul 4, 2023

We’re cleaning house! Storybook has changed a lot since this issue was created and we don’t know if it’s still valid. Please open a new issue referencing this one if this is still relevant in SB 7.x.

@shilman shilman closed this as not planned Won't fix, can't repro, duplicate, stale Jul 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants