Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | 332x 49x 37x 37x 37x 34x 81x 37x 48x | import { createFileRoute } from "@tanstack/react-router";
import { PeersScreen } from "~app/features/peers/peers-screen";
import { withDefaultLimit } from "~app/utils/store/limit";
import { getTitle } from "~web/utils/i18n";
import { searchParamsWithDefaults } from "~web/utils/navigation";
import { prefetchQueriesWith } from "~web/utils/ssr";
import { getLoaderTrpcClient } from "~web/utils/trpc";
export const Route = createFileRoute("/_protected/peers/")({
component: PeersScreen,
...searchParamsWithDefaults("/_protected/peers/"),
loaderDeps: ({ search: { offset, limit } }) => ({
offset,
limit,
}),
loader: async (ctx) => {
await ctx.context.i18nContext.loadNamespaces("peers");
const trpc = getLoaderTrpcClient(ctx.context);
const prefetched = await prefetchQueriesWith(
ctx,
() =>
ctx.context.queryClient.fetchQuery(
trpc.peers.getPaged.queryOptions({
limit: withDefaultLimit(ctx.deps.limit, ctx.context),
cursor: ctx.deps.offset,
}),
),
(list) => list.items.map((id) => trpc.peers.get.queryOptions({ id })),
);
return { prefetched };
},
head: ({ match }) => ({
meta: [{ title: getTitle(match.context.i18nContext, "peers") }],
}),
});
|