Merge branch 'next' into 6-4-docs

This commit is contained in:
Michael Shilman 2021-09-15 08:14:34 +08:00
commit 1d5ad31bbf
2 changed files with 19 additions and 2 deletions

View File

@ -148,7 +148,7 @@ const Story: FunctionComponent<StoryProps> = (props) => {
return null;
}
if (global?.FEATURES.modernInlineRender) {
if (global?.FEATURES?.modernInlineRender) {
// We do this so React doesn't complain when we replace the span in a secondary render
const htmlContents = `<span data-is-loading-indicator="true">loading story...</span>`;

View File

@ -1,4 +1,5 @@
import global from 'global';
import deprecate from 'util-deprecate';
import { ClientApi } from '@storybook/client-api';
import { WebProjectAnnotations, PreviewWeb } from '@storybook/preview-web';
import { AnyFramework, ArgsStoryFn } from '@storybook/csf';
@ -12,6 +13,13 @@ import { executeLoadableForChanges } from './executeLoadable';
const { window: globalWindow } = global;
const configureDeprecationWarning = deprecate(
() => {},
`\`configure()\` is deprecated and will be removed in Storybook 7.0.
Please use the \`stories\` field of \`main.js\` to load stories.
Read more at https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#deprecated-configure`
);
export function start<TFramework extends AnyFramework>(
renderToDOM: WebProjectAnnotations<TFramework>['renderToDOM'],
{
@ -52,7 +60,16 @@ export function start<TFramework extends AnyFramework>(
clientApi,
// This gets called each time the user calls configure (i.e. once per HMR)
// The first time, it constructs the preview, subsequently it updates it
configure(framework: string, loadable: Loadable, m?: NodeModule) {
configure(
framework: string,
loadable: Loadable,
m?: NodeModule,
showDeprecationWarning = true
) {
if (showDeprecationWarning) {
configureDeprecationWarning();
}
clientApi.addParameters({ framework });
// We need to run the `executeLoadableForChanges` function *inside* the `getProjectAnnotations