From c80ec5787f1397aee96d205dbba5cf7d6e2b8674 Mon Sep 17 00:00:00 2001 From: Petri-Johan Last Date: Wed, 17 Aug 2022 20:14:19 +0100 Subject: [PATCH] Remove last storybook/addon-knobs reference (#40498) * Remove last storybook/addon-knobs reference * Fix issue with infinite recursion in story * Remove failing snapshot Co-authored-by: Laura Hacker --- ...eamingProgressSkippedPopover.test.tsx.snap | 76 ------------------- client/storybook/src/preview.ts | 3 + .../Charts/core/components/SvgRoot.story.tsx | 13 +++- 3 files changed, 12 insertions(+), 80 deletions(-) diff --git a/client/search-ui/src/results/progress/__snapshots__/StreamingProgressSkippedPopover.test.tsx.snap b/client/search-ui/src/results/progress/__snapshots__/StreamingProgressSkippedPopover.test.tsx.snap index bd367d7c0c6..1c94270a85e 100644 --- a/client/search-ui/src/results/progress/__snapshots__/StreamingProgressSkippedPopover.test.tsx.snap +++ b/client/search-ui/src/results/progress/__snapshots__/StreamingProgressSkippedPopover.test.tsx.snap @@ -432,82 +432,6 @@ exports[`StreamingProgressSkippedPopover should render correctly 1`] = ` ) -
- - -
-
- - -
diff --git a/client/storybook/src/preview.ts b/client/storybook/src/preview.ts index 7745d49dd8e..b4009877afe 100644 --- a/client/storybook/src/preview.ts +++ b/client/storybook/src/preview.ts @@ -38,6 +38,9 @@ export const parameters: Parameters = { }, // disables snapshotting for all stories by default chromatic: { disableSnapshot: true }, + // This fixes an issue where some stories with knobs wound up in a state of infinite recursion + // See https://github.com/storybookjs/storybook/issues/15051 + docs: { source: { type: 'code' } }, } configureActions({ depth: 100, limit: 20 }) diff --git a/client/wildcard/src/components/Charts/core/components/SvgRoot.story.tsx b/client/wildcard/src/components/Charts/core/components/SvgRoot.story.tsx index ce6e029edfb..e2a527f8111 100644 --- a/client/wildcard/src/components/Charts/core/components/SvgRoot.story.tsx +++ b/client/wildcard/src/components/Charts/core/components/SvgRoot.story.tsx @@ -1,4 +1,3 @@ -import { boolean } from '@storybook/addon-knobs' import { Meta, Story } from '@storybook/react' import { AxisScale } from '@visx/axis/lib/types' import { ParentSize } from '@visx/responsive' @@ -17,6 +16,12 @@ const StoryConfig: Meta = { {() =>
{story()}
}
), ], + argTypes: { + useMaxValuesForYScale: { + type: 'boolean', + defaultValue: false, + }, + }, parameters: { chromatic: { disableSnapshots: false } }, } @@ -45,7 +50,7 @@ const SimpleChartTemplate: Story = args => ( ) -export const SmartAxisDemo: Story = () => ( +export const SmartAxisDemo: Story = args => (
({ @@ -54,7 +59,7 @@ export const SmartAxisDemo: Story = () => ( clamp: true, })} yScale={scaleLinear({ - domain: [0, boolean('useMaxValuesForYScale', false) ? 1000000000000000000000000000000000000 : 10000], + domain: [0, args.useMaxValuesForYScale ? 1000000000000000000000000000000000000 : 10000], nice: true, clamp: true, })} @@ -69,7 +74,7 @@ export const SmartAxisDemo: Story = () => ( padding: 0.2, })} yScale={scaleLinear({ - domain: [0, boolean('useMaxValuesForYScale', false) ? 1000000000000000000000000000000000000 : 10000], + domain: [0, args.useMaxValuesForYScale ? 1000000000000000000000000000000000000 : 10000], nice: true, clamp: true, })}