You've already forked authentication-service
mirror of
https://github.com/matrix-org/matrix-authentication-service.git
synced 2025-11-23 11:02:35 +03:00
Error boundary (#1743)
* reinstate link to browser session detail * add util hook for unwrapping current browser session id * fix bug in compatsessiondetail createdAt -> finishedAt * browser session detail page * tweak naming * add ErrorBoundary * useCurrentBrowserSessionId throw when error * add ErrorBoundary to pages * throw errors instead of rendering error * add unwrap util
This commit is contained in:
@@ -26,12 +26,11 @@ import {
|
||||
FIRST_PAGE,
|
||||
Pagination,
|
||||
} from "../pagination";
|
||||
import { isErr, isOk, unwrapErr, unwrapOk } from "../result";
|
||||
import { isOk, unwrap, unwrapOk } from "../result";
|
||||
import { useCurrentBrowserSessionId } from "../utils/session/useCurrentBrowserSessionId";
|
||||
|
||||
import BlockList from "./BlockList";
|
||||
import BrowserSession from "./BrowserSession";
|
||||
import GraphQLError from "./GraphQLError";
|
||||
import PaginationControls from "./PaginationControls";
|
||||
import { Title } from "./Typography";
|
||||
|
||||
@@ -113,19 +112,14 @@ const paginationFamily = atomFamily((userId: string) => {
|
||||
});
|
||||
|
||||
const BrowserSessionList: React.FC<{ userId: string }> = ({ userId }) => {
|
||||
const { currentBrowserSessionId, currentBrowserSessionIdError } =
|
||||
useCurrentBrowserSessionId();
|
||||
const currentBrowserSessionId = useCurrentBrowserSessionId();
|
||||
const [pending, startTransition] = useTransition();
|
||||
const result = useAtomValue(browserSessionListFamily(userId));
|
||||
const setPagination = useSetAtom(currentPaginationAtom);
|
||||
const [prevPage, nextPage] = useAtomValue(paginationFamily(userId));
|
||||
const [filter, setFilter] = useAtom(filterAtom);
|
||||
|
||||
if (currentBrowserSessionIdError)
|
||||
return <GraphQLError error={currentBrowserSessionIdError} />;
|
||||
if (isErr(result)) return <GraphQLError error={unwrapErr(result)} />;
|
||||
|
||||
const browserSessions = unwrapOk(result);
|
||||
const browserSessions = unwrap(result);
|
||||
if (browserSessions === null) return <>Failed to load browser sessions</>;
|
||||
|
||||
const paginate = (pagination: Pagination): void => {
|
||||
|
||||
Reference in New Issue
Block a user