Skip to content

Commit

Permalink
Suggest setting onlyChanged: true, and only suggest config updates wh…
Browse files Browse the repository at this point in the history
…en they're not explicitly set already
  • Loading branch information
ghengeveld committed May 14, 2024
1 parent d65f7c8 commit 7d1ae70
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
6 changes: 2 additions & 4 deletions src/components/Screen.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export const Default: Story = {};
const configuration = {
configFile: "chromatic.config.json",
projectId: "Project:6480e1b0042842f149cfd74c",
onlyChanged: true,
externals: ["public/**"],
autoAcceptChanges: "main",
exitOnceUploaded: true,
Expand All @@ -40,7 +39,7 @@ export const Configuration: Story = {
withSharedState(CONFIG_INFO, {
configuration,
problems: { storybookBaseDir: "src/frontend" },
suggestions: { zip: true },
suggestions: { onlyChanged: true, zip: true },
} satisfies ConfigInfoPayload),
],
parameters: {
Expand All @@ -55,7 +54,6 @@ export const ConfigurationProblems = {
withSharedState(CONFIG_INFO, {
configuration,
problems: { storybookBaseDir: "src/frontend" },
suggestions: { zip: true },
}),
],
} satisfies StoryObj<typeof meta>;
Expand All @@ -65,7 +63,7 @@ export const ConfigurationSuggestions = {
withSetup(() => localStorage.removeItem(CONFIG_INFO_DISMISSED)),
withSharedState(CONFIG_INFO, {
configuration,
suggestions: { zip: true },
suggestions: { onlyChanged: true, zip: true },
}),
],
} satisfies StoryObj<typeof meta>;
Expand Down
7 changes: 5 additions & 2 deletions src/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,11 @@ const getConfigInfo = async (
problems.storybookConfigDir = configDir;
}

if (!configuration.zip) {
if (configuration.onlyChanged === undefined) {
suggestions.onlyChanged = true;
}

if (configuration.zip === undefined) {
suggestions.zip = true;
}

Expand Down Expand Up @@ -181,7 +185,6 @@ async function serverChannel(channel: Channel, options: Options & { configFile?:
...config,
...problems,
...suggestions,
onlyChanged: true,
projectId,
});

Expand Down
2 changes: 1 addition & 1 deletion src/screens/VisualTests/Configuration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ export const Configuration = ({ onClose }: ConfigurationProps) => {
<CloseIcon aria-label="Close" />
</StyledCloseButton>
<PageWrapper>
<Heading>Configuration </Heading>
<Heading>Configuration</Heading>
{configFile ? (
<PageDescription>
This is a read-only representation of the Chromatic configuration options found in{" "}
Expand Down

0 comments on commit 7d1ae70

Please sign in to comment.