You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Apart from setting annotations in a set up file by importing them, users, addons or frameworks can also programatically add preview annotations via the previewAnnotations preset. Here's an example of what a user can do (though I think it's not so common):
And here's an example taken from our React renderer:
// Example taken from @storybook/react/presetexportconstpreviewAnnotations: PresetProperty<'previewAnnotations'>=async(input=[],options)=>{constdocsConfig=awaitoptions.presets.apply('docs',{},options);constfeatures=awaitoptions.presets.apply('features',{},options);constdocsEnabled=Object.keys(docsConfig).length>0;constresult: string[]=[];returnresult.concat(input).concat([join(__dirname,'entry-preview.mjs')]).concat(docsEnabled ? [join(__dirname,'entry-preview-docs.mjs')] : []).concat(features?.experimentalRSC ? [join(__dirname,'entry-preview-rsc.mjs')] : []);};
The react renderer example is interesting because the renderer has a portable stories entrypoint, which already adds the necessary annotations (and excludes the docs ones which are not needed), so that problem is solved when users call setProjectAnnotations coming from @storybook/react. However, this pattern would need to be documented for anyone creating community frameworks so that they can do the same thing.
💡 Solutions/Action items:
Do nothing, acknowledge this limitation
Document this properly. Users need to solve it by hand, framework authors need to provide the annotations (solved by CSF4 if the defineConfig function comes from frameworks)
Take this into account as part of a “preset handling” solution
The text was updated successfully, but these errors were encountered:
Apart from setting annotations in a set up file by importing them, users, addons or frameworks can also programatically add preview annotations via the
previewAnnotations
preset. Here's an example of what a user can do (though I think it's not so common):And here's an example taken from our React renderer:
The react renderer example is interesting because the renderer has a portable stories entrypoint, which already adds the necessary annotations (and excludes the docs ones which are not needed), so that problem is solved when users call
setProjectAnnotations
coming from@storybook/react
. However, this pattern would need to be documented for anyone creating community frameworks so that they can do the same thing.💡 Solutions/Action items:
The text was updated successfully, but these errors were encountered: