Skip to content

Commit a399f65

Browse files
refactor: replace useQueries with useQuery for improved data fetching in PreferencesView
1 parent 1a6c86a commit a399f65

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

web/sdk/admin/views/preferences/PreferencesView.tsx

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
DescribePreferencesResponse,
1010
} from "@raystack/proton/frontier";
1111
import { ExclamationTriangleIcon } from "@radix-ui/react-icons";
12-
import { useQueries } from "@tanstack/react-query";
12+
import { useQuery } from "@tanstack/react-query";
1313
import type { ConnectError } from "@connectrpc/connect";
1414
import PreferencesList from "./index";
1515
import PreferenceDetails from "./details";
@@ -27,17 +27,13 @@ export default function PreferencesView({
2727
}: PreferencesViewProps = {}) {
2828
const transport = useTransport();
2929

30-
const [preferencesQuery, traitsQuery] = useQueries({
31-
queries: [
32-
{
33-
...createQueryOptions(AdminServiceQueries.listPreferences, {}, { transport }),
34-
staleTime: Infinity,
35-
},
36-
{
37-
...createQueryOptions(FrontierServiceQueries.describePreferences, {}, { transport }),
38-
staleTime: Infinity,
39-
},
40-
],
30+
const preferencesQuery = useQuery({
31+
...createQueryOptions(AdminServiceQueries.listPreferences, {}, { transport }),
32+
staleTime: Infinity,
33+
});
34+
const traitsQuery = useQuery({
35+
...createQueryOptions(FrontierServiceQueries.describePreferences, {}, { transport }),
36+
staleTime: Infinity,
4137
});
4238

4339
const preferences = ((preferencesQuery.data as ListPreferencesResponse)?.preferences || []) as Preference[];

0 commit comments

Comments
 (0)