hrefTo
function in links addon doesn't need to be async
#23939
JoshTumath
started this conversation in
Ideas
Replies: 1 comment
-
I've just happened to have stumbled into this problem myself, it would be great to see it resolved |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Is your feature request related to a problem? Please describe.
In my team, we make our own Storybook block components, in React, to link to other stories, like so. We use the
linkTo
function from the links addon to achieve that.We also want to use the
hrefTo
function from the links addon to link to other stories so that users can still middle click or command-click on our links so that they can open the links in a new tab. However, we can't because thehrefTo
function is async. Rendering asynchronously fetched content in a React component is more hassle, so we don't want to use it.We looked at the implementation code for the
hrefTo
function, and it doesn't seem as though it's doing anything async anyway. It looks like it could be easily converted to a synchronous function.https://github.com/storybookjs/storybook/blob/next/code/addons/links/src/utils.ts#L37-L56
Describe the solution you'd like
I would like the
hrefTo
function to not be async (i.e. not use a Promise).Describe alternatives you've considered
No response
Are you able to assist to bring the feature to reality?
no
Additional context
No response
Beta Was this translation helpful? Give feedback.
All reactions