Skip to content

Commit 3f8cc16

Browse files
feat: refresh button groups list
1 parent 9b00e5b commit 3f8cc16

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

  • src/app/dashboard/(active)/telegram/groups

src/app/dashboard/(active)/telegram/groups/page.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use client"
22
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"
3-
import { ArrowLeft, Copy, Pen, Search, X } from "lucide-react"
3+
import { ArrowLeft, Copy, Pen, RefreshCcw, Search, X } from "lucide-react"
44
import Link from "next/link"
55
import { useState } from "react"
66
import { toast } from "sonner"
@@ -19,7 +19,7 @@ export default function TgGroups() {
1919
const trpc = useTRPC()
2020
const qc = useQueryClient()
2121
const queryOpts = trpc.tg.groups.search.queryOptions({ query, limit: 20, showHidden: true })
22-
const { data: allGroups, isLoading } = useQuery(trpc.tg.groups.getAll.queryOptions())
22+
const { data: allGroups, isLoading, refetch } = useQuery(trpc.tg.groups.getAll.queryOptions())
2323

2424
const [rows, setRows] = useState<Groups>(!isLoading ? (allGroups ?? []) : [])
2525

@@ -31,6 +31,7 @@ export default function TgGroups() {
3131

3232
async function invalidate() {
3333
await qc.invalidateQueries(queryOpts)
34+
refetch()
3435
await search()
3536
}
3637

@@ -78,6 +79,10 @@ export default function TgGroups() {
7879
Reset
7980
</Button>
8081
)}
82+
<Button variant="outline" onClick={invalidate}>
83+
<RefreshCcw />
84+
Refresh
85+
</Button>
8186
</div>
8287
<span className="text-muted-foreground text-xs">Max results: 20</span>
8388
</div>

0 commit comments

Comments
 (0)