Skip to content

Commit

Permalink
feat: add gcTime in case of large amount of searches
Browse files Browse the repository at this point in the history
  • Loading branch information
eirikhaugstulen committed Feb 19, 2024
1 parent f7785aa commit f88b394
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export const useSearchScopeWithFallback = ({ searchText }: Props) => {
},
{
enabled: !searchText,
// Clearing cache after 60 minutes to avoid memory leaks
cacheTime: 60 * 60 * 1000,
select: (data) => {
const { teiSearchOrganisationUnits, organisationUnits } = data;
return teiSearchOrganisationUnits.length
Expand All @@ -41,6 +43,8 @@ export const useSearchScopeWithFallback = ({ searchText }: Props) => {
},
{
enabled: Boolean(searchText),
// Clearing cache after 60 minutes to avoid memory leaks
cacheTime: 60 * 60 * 1000,
select: (data) => {
const { organisationUnits } = data;
return organisationUnits;
Expand Down

0 comments on commit f88b394

Please sign in to comment.