1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-11-20 12:02:22 +03:00

Fix typings post-router upgrade

This commit is contained in:
Quentin Gliech
2024-04-30 15:29:38 +02:00
parent 94f162f249
commit 4501bfb504
6 changed files with 17 additions and 26 deletions

View File

@@ -6,6 +6,7 @@ exports[`<SessionHeader /> > renders a session header 1`] = `
class="_header_92353c"
>
<a
aria-current="page"
class="_backButton_92353c active"
data-status="active"
href="/"

View File

@@ -36,6 +36,7 @@ exports[`<UnverifiedEmailAlert /> > renders a warning when there are unverified
You have 2 unverified email addresses.
<a
aria-current="page"
class="_link_1mzip_17 active"
data-kind="primary"
data-status="active"

View File

@@ -65,7 +65,7 @@ export const Route = createRootRouteWithContext<{
case "sessions_list":
case "org.matrix.sessions_list":
throw redirect({ to: "/sessions/", search: { last: PAGE_SIZE } });
throw redirect({ to: "/sessions", search: { last: PAGE_SIZE } });
case "session_view":
case "org.matrix.session_view":
@@ -74,7 +74,7 @@ export const Route = createRootRouteWithContext<{
to: "/devices/$id",
params: { id: search.device_id },
});
throw redirect({ to: "/sessions/", search: { last: PAGE_SIZE } });
throw redirect({ to: "/sessions", search: { last: PAGE_SIZE } });
case "session_end":
case "org.matrix.session_end":
@@ -83,11 +83,11 @@ export const Route = createRootRouteWithContext<{
to: "/devices/$id",
params: { id: search.device_id },
});
throw redirect({ to: "/sessions/", search: { last: PAGE_SIZE } });
throw redirect({ to: "/sessions", search: { last: PAGE_SIZE } });
case "org.matrix.cross_signing_reset":
throw redirect({
to: "/reset-cross-signing/",
to: "/reset-cross-signing",
search: { deepLink: true },
});
}

View File

@@ -21,12 +21,7 @@ import BlockList from "../components/BlockList";
import BrowserSession from "../components/BrowserSession";
import { ButtonLink } from "../components/ButtonLink";
import { graphql } from "../gql";
import {
Pagination,
isForwardPagination,
paginationSchema,
usePages,
} from "../pagination";
import { Pagination, paginationSchema, usePages } from "../pagination";
const PAGE_SIZE = 6;
@@ -77,12 +72,11 @@ const QUERY = graphql(/* GraphQL */ `
export const Route = createFileRoute("/_account/sessions/browsers")({
// We paginate backwards, so we need to validate the `last` parameter by default
validateSearch: paginationSchema.catch({ last: PAGE_SIZE }),
validateSearch: paginationSchema.catch({
last: PAGE_SIZE,
}),
loaderDeps: ({ search }): Pagination =>
isForwardPagination(search)
? { first: search.first, after: search.after }
: { last: search.last, before: search.before },
loaderDeps: ({ search }): Pagination => paginationSchema.parse(search),
async loader({ context, deps: pagination, abortController: { signal } }) {
const result = await context.client.query(QUERY, pagination, {

View File

@@ -23,12 +23,7 @@ import CompatSession from "../components/CompatSession";
import OAuth2Session from "../components/OAuth2Session";
import BrowserSessionsOverview from "../components/UserSessionsOverview/BrowserSessionsOverview";
import { graphql } from "../gql";
import {
Pagination,
isForwardPagination,
paginationSchema,
usePages,
} from "../pagination";
import { Pagination, paginationSchema, usePages } from "../pagination";
const PAGE_SIZE = 6;
@@ -95,10 +90,7 @@ export const Route = createFileRoute("/_account/sessions/")({
// We paginate backwards, so we need to validate the `last` parameter by default
validateSearch: paginationSchema.catch({ last: PAGE_SIZE }),
loaderDeps: ({ search }): Pagination =>
isForwardPagination(search)
? { first: search.first, after: search.after }
: { last: search.last, before: search.before },
loaderDeps: ({ search }): Pagination => paginationSchema.parse(search),
async loader({ context, deps: pagination, abortController: { signal } }) {
const [overview, list] = await Promise.all([

View File

@@ -36,4 +36,7 @@ beforeAll(async () => await routerReady);
export const DummyRouter: React.FC<React.PropsWithChildren> = ({
children,
}) => <RouterProvider router={router} defaultComponent={() => children} />;
}) => (
/** @ts-expect-error: The router we pass doesn't match the "real" router, which is fine for tests */
<RouterProvider router={router} defaultComponent={() => children} />
);