Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
thibaultleouay committed Oct 6, 2024
1 parent 57f1f26 commit 92b489f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion apps/web/src/trpc/query-client.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
defaultShouldDehydrateQuery,
QueryClient,
defaultShouldDehydrateQuery,
} from "@tanstack/react-query";
import superjson from "superjson";

Expand Down
7 changes: 4 additions & 3 deletions apps/web/src/trpc/rq-client.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
"use client";

import type { AppRouter } from "@openstatus/api";
import type { QueryClient } from "@tanstack/react-query";
import { QueryClientProvider } from "@tanstack/react-query";
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
import { createTRPCReact } from "@trpc/react-query";
import { useState } from "react";
import { makeQueryClient } from "./query-client";
import { AppRouter } from "@openstatus/api";
import { endingLink } from "./shared";

export const api = createTRPCReact<AppRouter>();
Expand All @@ -17,13 +17,14 @@ function getQueryClient() {
return makeQueryClient();
}
// Browser: use singleton pattern to keep the same query client
// biome-ignore lint/suspicious/noAssignInExpressions: <explanation>
return (clientQueryClientSingleton ??= makeQueryClient());
}

export function TRPCReactQueryProvider(
props: Readonly<{
children: React.ReactNode;
}>
}>,
) {
// NOTE: Avoid useState when initializing the query client if you don't
// have a suspense boundary between this and the code that may
Expand All @@ -39,7 +40,7 @@ export function TRPCReactQueryProvider(
},
}),
],
})
}),
);
return (
<api.Provider client={trpcClient} queryClient={queryClient}>
Expand Down
12 changes: 6 additions & 6 deletions apps/web/src/trpc/rq-server.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import "server-only";

import { auth } from "@/lib/auth";
import { type AppRouter, appRouter, t } from "@openstatus/api";
import type { Context } from "@openstatus/api/src/trpc";
import { db } from "@openstatus/db";
import { createHydrationHelpers } from "@trpc/react-query/rsc";
import { cache } from "react";
import { makeQueryClient } from "./query-client";
import { type AppRouter, appRouter, t } from "@openstatus/api";
import { Context } from "@openstatus/api/src/trpc";
import { db } from "@openstatus/db";
import { auth } from "@/lib/auth";

const createContextCached = cache(
async (...args: unknown[]): Promise<Context> => {
Expand All @@ -17,7 +17,7 @@ const createContextCached = cache(
db,
session,
};
}
},
);

// IMPORTANT: Create a stable getter for the query client that
Expand All @@ -26,5 +26,5 @@ export const getQueryClient = cache(makeQueryClient);
const caller = t.createCallerFactory(appRouter)(createContextCached);
export const { trpc: api, HydrateClient } = createHydrationHelpers<AppRouter>(
caller,
getQueryClient
getQueryClient,
);
1 change: 1 addition & 0 deletions apps/web/src/trpc/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const endingLink = (opts?: {
const sharedOpts = {
headers: opts?.headers, // REMINDER: fails when trying to `getTotalActiveMonitors()`
transformer: superjson,
// biome-ignore lint/suspicious/noExplicitAny: FIXME: remove any
} satisfies Partial<HTTPBatchLinkOptions<any>>;

const edgeLink = httpBatchLink({
Expand Down

0 comments on commit 92b489f

Please sign in to comment.