Skip to content

Commit 9e476e9

Browse files
feat: remove react-query
1 parent 552ed5f commit 9e476e9

8 files changed

Lines changed: 19 additions & 78 deletions

File tree

package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,9 @@
1919
"@polinetwork/backend": "^0.15.15",
2020
"@radix-ui/react-dialog": "^1.1.15",
2121
"@t3-oss/env-nextjs": "^0.13.10",
22-
"@tanstack/react-query": "^5.90.19",
2322
"@tanstack/react-table": "^8.21.2",
2423
"@trpc/client": "11.5.1",
2524
"@trpc/next": "11.5.1",
26-
"@trpc/react-query": "11.5.1",
27-
"@trpc/tanstack-react-query": "11.5.1",
2825
"babel-plugin-react-compiler": "1.0.0",
2926
"better-auth": "^1.5.5",
3027
"class-variance-authority": "^0.7.1",

pnpm-lock.yaml

Lines changed: 4 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/(auth)/onboarding/no-role/page.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,16 @@ import Image from "next/image"
22
import { redirect } from "next/navigation"
33
import loginSvg2 from "@/assets/svg/login-2.svg"
44
import { Card } from "@/components/ui/card"
5+
import { getUserRoles } from "@/server/actions/users"
56
import { getServerSession } from "@/server/auth"
6-
import { getQueryClient, trpc } from "@/server/trpc/server"
77
import { Logout } from "../link/logout"
88

99
export default async function OnboardingNoRole() {
1010
const { data: session } = await getServerSession()
1111
if (!session) redirect("/login")
1212
if (!session.user.telegramId) redirect("/onboarding/link")
1313

14-
const qc = getQueryClient()
15-
const { roles } = await qc.fetchQuery(trpc.tg.permissions.getRoles.queryOptions({ userId: session.user.telegramId }))
14+
const { roles } = await getUserRoles(session.user.telegramId)
1615
if (roles?.includes("creator")) redirect("/onboarding/unauthorized")
1716
if (roles && roles.length > 0) redirect("/dashboard")
1817

src/app/dashboard/(active)/telegram/groups/search-input.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use client"
22

3-
import { RefreshCcw, Search, X } from "lucide-react"
3+
import { RefreshCcw, Search } from "lucide-react"
44
import { useRouter, useSearchParams } from "next/navigation"
55
import { useState } from "react"
66
import { Button } from "@/components/ui/button"
@@ -9,7 +9,7 @@ import { Input } from "@/components/ui/input"
99
export function SearchInput() {
1010
const router = useRouter()
1111
const searchParams = useSearchParams()
12-
const search = searchParams.get("q")
12+
const _search = searchParams.get("q")
1313
const [value, setValue] = useState(searchParams.get("q") ?? "")
1414

1515
const handleSearch = () => {

src/app/dashboard/(active)/telegram/user-details/add-role.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
"use client"
22
import { USER_ROLE } from "@polinetwork/backend"
3-
import { useMutation, useQueryClient } from "@tanstack/react-query"
4-
import { Plus, Search, X } from "lucide-react"
5-
import { useRouter } from "next/navigation"
3+
import { Plus } from "lucide-react"
64
import { useState } from "react"
75
import { toast } from "sonner"
86
import { Badge } from "@/components/ui/badge"
@@ -20,7 +18,7 @@ import {
2018
import { Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"
2119
import { useSession } from "@/lib/auth"
2220
import { addUserRole } from "@/server/actions/users"
23-
import type { ApiOutput, TgUser, TgUserRole } from "@/server/trpc/types"
21+
import type { TgUser, TgUserRole } from "@/server/trpc/types"
2422

2523
const ARRAY_USER_ROLES = [
2624
USER_ROLE.ADMIN,

src/app/testtrpc/page.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
import { getQueryClient, trpc } from "@/server/trpc/server"
1+
import { testDb } from "@/server/actions/test"
22
export const dynamic = "force-dynamic"
33

44
export default async function TestTRPCPage() {
5-
const queryClient = getQueryClient()
6-
const rows = await queryClient.fetchQuery(trpc.test.dbQuery.queryOptions({ dbName: "tg" }))
5+
const data = await testDb()
76

87
return (
98
<div className="flex w-full flex-col gap-4 p-4">
109
<p>Test with tRPC. Get the table `test.tg`</p>
1110
<ol className="list-inside px-4">
12-
{rows.map((r, i) => (
11+
{data.map((r, i) => (
1312
<li key={i} className="flex-1 list-decimal">
1413
{r}
1514
</li>

src/server/actions/test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
"use server"
2+
import { trpc } from "../trpc"
3+
4+
export async function testDb() {
5+
return trpc.test.dbQuery.query({ dbName: "tg" })
6+
}

src/server/trpc/server.tsx

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)