Skip to content

Commit

Permalink
perf(FiltersPanel): drop extra refetch
Browse files Browse the repository at this point in the history
  • Loading branch information
KateKate committed Jul 31, 2023
1 parent 9fdf405 commit 5fb37eb
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions src/components/FiltersPanel/FiltersPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,14 @@ import { WatchingFilter } from '../WatchingFilter/WatchingFilter';
import { tr } from './FiltersPanel.i18n';

const take = 5;
const queryParams = {

// disable refetchOnMount since we use filtersPanelSsrInit
const useQueryOptionsRefetchOnMount = {
refetchOnMount: false,
};

const useQueryOptions = {
...useQueryOptionsRefetchOnMount,
keepPreviousData: true,
};

Expand Down Expand Up @@ -130,7 +137,7 @@ export const FiltersPanel: FC<{
include: queryState.owner,
take,
},
queryParams,
useQueryOptions,
);

const [issuersQuery, setIssuersQuery] = useState('');
Expand All @@ -141,7 +148,7 @@ export const FiltersPanel: FC<{
include: queryState.issuer,
take,
},
queryParams,
useQueryOptions,
);

const [participantsQuery, setParticipantsQuery] = useState('');
Expand All @@ -152,7 +159,7 @@ export const FiltersPanel: FC<{
include: queryState.participant,
take,
},
queryParams,
useQueryOptions,
);

const [projectsQuery, setProjectsQuery] = useState('');
Expand All @@ -163,7 +170,7 @@ export const FiltersPanel: FC<{
include: queryState.project,
take,
},
queryParams,
useQueryOptions,
);

const [tagsQuery, setTagsQuery] = useState('');
Expand All @@ -174,11 +181,11 @@ export const FiltersPanel: FC<{
include: queryState.tag,
take,
},
queryParams,
useQueryOptions,
);

const { data: states = [] } = trpc.state.all.useQuery();
const { data: estimates = [] } = trpc.estimates.all.useQuery();
const { data: states = [] } = trpc.state.all.useQuery(undefined, useQueryOptionsRefetchOnMount);
const { data: estimates = [] } = trpc.estimates.all.useQuery(undefined, useQueryOptionsRefetchOnMount);

return (
<>
Expand Down

0 comments on commit 5fb37eb

Please sign in to comment.