Skip to content

Commit c0cfc3c

Browse files
committed
Flat ErrorBoundaryState and refactor stories
1 parent fed2622 commit c0cfc3c

File tree

4 files changed

+26
-31
lines changed

4 files changed

+26
-31
lines changed

site/src/components/ErrorBoundary/ErrorBoundary.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Component, ReactNode, PropsWithChildren } from "react";
2-
import { RuntimeErrorState } from "./RuntimeErrorState/RuntimeErrorState";
2+
import { RuntimeErrorState } from "./RuntimeErrorState";
33

44
type ErrorBoundaryProps = PropsWithChildren<unknown>;
55

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import type { Meta, StoryObj } from "@storybook/react";
2+
import { RuntimeErrorState } from "./RuntimeErrorState";
3+
4+
const error = new Error("An error occurred");
5+
6+
const meta: Meta<typeof RuntimeErrorState> = {
7+
title: "components/RuntimeErrorState",
8+
component: RuntimeErrorState,
9+
args: {
10+
error,
11+
},
12+
parameters: {
13+
// The RuntimeErrorState is noisy for chromatic, because it renders an actual error
14+
// along with the stacktrace - and the stacktrace includes the full URL of
15+
// scripts in the stack. This is problematic, because every deployment uses
16+
// a different URL, causing the validation to fail.
17+
chromatic: { disableSnapshot: true },
18+
},
19+
};
20+
21+
export default meta;
22+
type Story = StoryObj<typeof RuntimeErrorState>;
23+
24+
export const Errored: Story = {};

site/src/components/ErrorBoundary/RuntimeErrorState/RuntimeErrorState.tsx renamed to site/src/components/ErrorBoundary/RuntimeErrorState.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { FullScreenLoader } from "components/Loader/FullScreenLoader";
99
import { Stack } from "components/Stack/Stack";
1010
import { FC, useEffect, useState } from "react";
1111
import { Helmet } from "react-helmet-async";
12-
import { Margins } from "../../Margins/Margins";
12+
import { Margins } from "components/Margins/Margins";
1313

1414
const fetchDynamicallyImportedModuleError =
1515
"Failed to fetch dynamically imported module";

site/src/components/ErrorBoundary/RuntimeErrorState/RuntimeErrorState.stories.tsx

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)