Skip to content

Commit

Permalink
fix: правильный root layout для Next 13
Browse files Browse the repository at this point in the history
  • Loading branch information
mxseev committed Nov 24, 2022
1 parent bd9f7bd commit 4deeb27
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 63 deletions.
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true
}
58 changes: 0 additions & 58 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
"next-axiom": "0.15.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"superjson": "^1.11.0",
"zod": "^3.19.1"
},
"devDependencies": {
Expand Down
7 changes: 6 additions & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ type Props = {
}

const RootLayout: FC<Props> = ({children}) => (
<TRPCClientProvider>{children}</TRPCClientProvider>
<html lang="en">
<head />
<body>
<TRPCClientProvider>{children}</TRPCClientProvider>
</body>
</html>
)

export default RootLayout
4 changes: 1 addition & 3 deletions src/datasources/trpc.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
"use client"

// based on https://github.com/trpc/next-13/blob/main/client/trpcClient.tsx
// TODO wait for complete Next 13 support in tRPC and migrate
// TODO wait for complete Next 13 support in tRPC and migrate to @trpc/next-layout

import {FC, ReactNode, useState} from "react"
import {httpBatchLink} from "@trpc/client"
import {createTRPCReact} from "@trpc/react-query"
import {QueryClient, QueryClientProvider} from "@tanstack/react-query"
import superjson from "superjson"

import type {AppRouter} from "server/routers"

Expand Down Expand Up @@ -50,7 +49,6 @@ const TRPCClientProvider: FC<Props> = ({children}) => {
const links = [httpBatchLink({url: trpcUrl})]

return trpc.createClient({
transformer: superjson,
links
})
})
Expand Down

0 comments on commit 4deeb27

Please sign in to comment.