review: Make widget prop mandatory
This commit is contained in:
@@ -10,6 +10,7 @@ import { PopOutIcon } from "@vector-im/compound-design-tokens/assets/web/icons";
|
|||||||
|
|
||||||
import type { FC, ReactNode } from "react";
|
import type { FC, ReactNode } from "react";
|
||||||
import { ErrorView } from "./ErrorView";
|
import { ErrorView } from "./ErrorView";
|
||||||
|
import { widget } from "./widget.ts";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An error consisting of a terse message to be logged to the console and a
|
* An error consisting of a terse message to be logged to the console and a
|
||||||
@@ -32,7 +33,7 @@ const OpenElsewhere: FC = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<ErrorView
|
<ErrorView
|
||||||
widget={null}
|
widget={widget}
|
||||||
Icon={PopOutIcon}
|
Icon={PopOutIcon}
|
||||||
title={t("error.open_elsewhere")}
|
title={t("error.open_elsewhere")}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ test.each<[string, ConnectionError]>([
|
|||||||
const user = userEvent.setup();
|
const user = userEvent.setup();
|
||||||
render(
|
render(
|
||||||
<MemoryRouter>
|
<MemoryRouter>
|
||||||
<GroupCallErrorBoundary recoveryActionHandler={vi.fn()}>
|
<GroupCallErrorBoundary recoveryActionHandler={vi.fn()} widget={null}>
|
||||||
<TestComponent />
|
<TestComponent />
|
||||||
</GroupCallErrorBoundary>
|
</GroupCallErrorBoundary>
|
||||||
</MemoryRouter>,
|
</MemoryRouter>,
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ test.each([
|
|||||||
<GroupCallErrorBoundary
|
<GroupCallErrorBoundary
|
||||||
onError={onErrorMock}
|
onError={onErrorMock}
|
||||||
recoveryActionHandler={vi.fn()}
|
recoveryActionHandler={vi.fn()}
|
||||||
|
widget={null}
|
||||||
>
|
>
|
||||||
<TestComponent />
|
<TestComponent />
|
||||||
</GroupCallErrorBoundary>
|
</GroupCallErrorBoundary>
|
||||||
@@ -95,6 +96,7 @@ test("should render the error page with link back to home", async () => {
|
|||||||
<GroupCallErrorBoundary
|
<GroupCallErrorBoundary
|
||||||
onError={onErrorMock}
|
onError={onErrorMock}
|
||||||
recoveryActionHandler={vi.fn()}
|
recoveryActionHandler={vi.fn()}
|
||||||
|
widget={null}
|
||||||
>
|
>
|
||||||
<TestComponent />
|
<TestComponent />
|
||||||
</GroupCallErrorBoundary>
|
</GroupCallErrorBoundary>
|
||||||
@@ -139,7 +141,10 @@ test("ConnectionLostError: Action handling should reset error state", async () =
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<BrowserRouter>
|
<BrowserRouter>
|
||||||
<GroupCallErrorBoundary recoveryActionHandler={reconnectCallback}>
|
<GroupCallErrorBoundary
|
||||||
|
recoveryActionHandler={reconnectCallback}
|
||||||
|
widget={null}
|
||||||
|
>
|
||||||
<TestComponent fail={failState} />
|
<TestComponent fail={failState} />
|
||||||
</GroupCallErrorBoundary>
|
</GroupCallErrorBoundary>
|
||||||
</BrowserRouter>
|
</BrowserRouter>
|
||||||
@@ -181,6 +186,7 @@ describe("Rageshake button", () => {
|
|||||||
<GroupCallErrorBoundary
|
<GroupCallErrorBoundary
|
||||||
onError={vi.fn()}
|
onError={vi.fn()}
|
||||||
recoveryActionHandler={vi.fn()}
|
recoveryActionHandler={vi.fn()}
|
||||||
|
widget={null}
|
||||||
>
|
>
|
||||||
<TestComponent />
|
<TestComponent />
|
||||||
</GroupCallErrorBoundary>
|
</GroupCallErrorBoundary>
|
||||||
@@ -221,7 +227,11 @@ test("should have a close button in widget mode", async () => {
|
|||||||
const onErrorMock = vi.fn();
|
const onErrorMock = vi.fn();
|
||||||
const { asFragment } = render(
|
const { asFragment } = render(
|
||||||
<BrowserRouter>
|
<BrowserRouter>
|
||||||
<GroupCallErrorBoundary widget={mockWidget} onError={onErrorMock}>
|
<GroupCallErrorBoundary
|
||||||
|
widget={mockWidget}
|
||||||
|
onError={onErrorMock}
|
||||||
|
recoveryActionHandler={vi.fn()}
|
||||||
|
>
|
||||||
<TestComponent />
|
<TestComponent />
|
||||||
</GroupCallErrorBoundary>
|
</GroupCallErrorBoundary>
|
||||||
</BrowserRouter>,
|
</BrowserRouter>,
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ interface BoundaryProps {
|
|||||||
children: ReactNode | (() => ReactNode);
|
children: ReactNode | (() => ReactNode);
|
||||||
recoveryActionHandler: RecoveryActionHandler;
|
recoveryActionHandler: RecoveryActionHandler;
|
||||||
onError?: (error: unknown) => void;
|
onError?: (error: unknown) => void;
|
||||||
widget?: WidgetHelpers | null;
|
widget: WidgetHelpers | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const GroupCallErrorBoundary = ({
|
export const GroupCallErrorBoundary = ({
|
||||||
|
|||||||
Reference in New Issue
Block a user