Skip to content

Commit 0fa6b3d

Browse files
chore: ignore dynamic content on chromatic (#16214)
1 parent f8844ca commit 0fa6b3d

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

site/src/components/ErrorBoundary/GlobalErrorBoundary.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,9 @@ const ErrorStack: FC<ErrorStackProps> = ({ error }) => {
128128
</p>
129129
{error.stack && (
130130
<pre className="m-0 py-2 px-0 overflow-x-auto text-xs">
131-
<code data-testid="code">{error.stack}</code>
131+
<code data-testid="code" data-chromatic="ignore">
132+
{error.stack}
133+
</code>
132134
</pre>
133135
)}
134136
</>

site/src/pages/CliInstallPage/CliInstallPage.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1+
import isChromatic from "chromatic/isChromatic";
12
import type { FC } from "react";
23
import { Helmet } from "react-helmet-async";
34
import { pageTitle } from "utils/page";
45
import { CliInstallPageView } from "./CliInstallPageView";
56

67
export const CliInstallPage: FC = () => {
8+
const origin = isChromatic() ? "https://example.com" : window.location.origin;
9+
710
return (
811
<>
912
<Helmet>
1013
<title>{pageTitle("Install the Coder CLI")}</title>
1114
</Helmet>
12-
<CliInstallPageView />
15+
<CliInstallPageView origin={origin} />
1316
</>
1417
);
1518
};

site/src/pages/CliInstallPage/CliInstallPageView.stories.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ import { CliInstallPageView } from "./CliInstallPageView";
44
const meta: Meta<typeof CliInstallPageView> = {
55
title: "pages/CliInstallPage",
66
component: CliInstallPageView,
7+
args: {
8+
origin: "https://example.com",
9+
},
710
};
811

912
export default meta;

site/src/pages/CliInstallPage/CliInstallPageView.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ import { Welcome } from "components/Welcome/Welcome";
44
import type { FC } from "react";
55
import { Link as RouterLink } from "react-router-dom";
66

7-
export const CliInstallPageView: FC = () => {
8-
const origin = location.origin;
7+
type CliInstallPageViewProps = {
8+
origin: string;
9+
};
910

11+
export const CliInstallPageView: FC<CliInstallPageViewProps> = ({ origin }) => {
1012
return (
1113
<div css={styles.container}>
1214
<Welcome>Install the Coder CLI</Welcome>
@@ -18,7 +20,6 @@ export const CliInstallPageView: FC = () => {
1820

1921
<CodeExample
2022
css={{ maxWidth: "100%" }}
21-
data-chromatic="ignore"
2223
code={`curl -fsSL ${origin}/install.sh | sh`}
2324
secret={false}
2425
/>

0 commit comments

Comments
 (0)