Skip to content

Commit

Permalink
Optimal implementation of shouldShowSearchText
Browse files Browse the repository at this point in the history
  • Loading branch information
rique223 committed Sep 11, 2023
1 parent 4f2f252 commit fadc452
Showing 1 changed file with 1 addition and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ export const useFilteredApps = ({
}

const { apps } = appsData.value;

let shouldShowSearchText = false;
const fallback = (apps: App[]) => apps;

const sortingMethods: Record<string, (apps: App[]) => App[]> = {
Expand Down Expand Up @@ -96,8 +94,7 @@ export const useFilteredApps = ({
sortingMethods[sortingMethod],
)(apps);

if (text) shouldShowSearchText = true;

const shouldShowSearchText = !!text;
const total = filtered.length;
const offset = current > total ? 0 : current;
const end = current + itemsPerPage;
Expand Down

0 comments on commit fadc452

Please sign in to comment.