From 4fb913d7d7e6e9a507657ce8e5c03503dc0a7a9f Mon Sep 17 00:00:00 2001 From: Pavlo Zhukov Date: Wed, 27 Oct 2021 19:12:56 +0300 Subject: [PATCH] fix: provide args values from url to control https://github.com/storybookjs/storybook/issues/15278 --- lib/preview-web/src/PreviewWeb.tsx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/preview-web/src/PreviewWeb.tsx b/lib/preview-web/src/PreviewWeb.tsx index 1c17dd62f19d..87b41edfdc7c 100644 --- a/lib/preview-web/src/PreviewWeb.tsx +++ b/lib/preview-web/src/PreviewWeb.tsx @@ -529,6 +529,17 @@ export class PreviewWeb { unboundStoryFn, }; + // Populate args from url to ArgsTable controls. + if (initial) { + const { args, storySpecifier } = this.urlStore.selectionSpecifier; + if (Object.keys(args).length > 0) { + this.channel.emit(Events.STORY_ARGS_UPDATED, { + storyId: storySpecifier, + updatedArgs: args, + }); + } + } + try { if (!this.renderToDOM) { throw new Error(dedent`