⚡ admin users lookup uses getUserById instead of filtering full list
Browse files at this commit3095fe1a720bca9233ab234926f5bae510827681Parent: 7befd0c- perf
- ⚡ admin users lookup uses getUserById instead of filtering full list
1 changed file +3 -3
src/pages/admin-users-page.tsxmodified+3 -3
| @@ -1,4 +1,5 @@ | |||
| 1 | import { For, Show, Suspense, createMemo, createResource, createSignal } from "solid-js"; | 1 | import { For, Show, Suspense, createMemo, createResource, createSignal } from "solid-js"; |
| 2 | +import { getUserById } from "@/api/getUserById"; | ||
| 2 | import { getUsers } from "@/api/getUsers"; | 3 | import { getUsers } from "@/api/getUsers"; |
| 3 | import { patchUserRole } from "@/api/patchUserRole"; | 4 | import { patchUserRole } from "@/api/patchUserRole"; |
| 4 | import { formatApiError } from "@/api/client"; | 5 | import { formatApiError } from "@/api/client"; |
| @@ -43,9 +44,8 @@ function AdminUsersContent() { | |||
| 43 | }), | 44 | }), |
| 44 | async (key) => { | 45 | async (key) => { |
| 45 | if (key.selected) { | 46 | if (key.selected) { |
| 46 | - const all = await getUsers(); | 47 | + const user = await getUserById(key.selected); |
| 47 | - const match = all.items.filter((user) => user.id === key.selected); | 48 | + return { items: [user], total: 1 }; |
| 48 | - return { items: match, total: match.length }; | ||
| 49 | } | 49 | } |
| 50 | return loadListPage({ | 50 | return loadListPage({ |
| 51 | page: key.page, | 51 | page: key.page, |