Skip to content

Commit

Permalink
fix: failing apps test
Browse files Browse the repository at this point in the history
  • Loading branch information
compojoom committed Jun 3, 2024
1 parent 11a347c commit b1f486e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/pages/apps/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ const SafeApps: NextPage = () => {
const allApps = [swapsCardDetails, ...remoteSafeApps]

Check warning on line 22 in src/pages/apps/index.tsx

View workflow job for this annotation

GitHub Actions / ESLint Results

react-hooks/exhaustive-deps

The 'allApps' array makes the dependencies of useMemo Hook (at line 30) change on every render. To fix this, wrap the initialization of 'allApps' in its own useMemo() Hook.
const { filteredApps, query, setQuery, setSelectedCategories, setOptimizedWithBatchFilter, selectedCategories } =
useSafeAppsFilters(allApps)
const isFiltered = filteredApps.length !== remoteSafeApps.length
const isFiltered = filteredApps.length !== allApps.length
const isSafeAppsEnabled = useHasFeature(FEATURES.SAFE_APPS)

const nonPinnedApps = useMemo(
() => remoteSafeApps.filter((app) => !pinnedSafeAppIds.has(app.id)),
[remoteSafeApps, pinnedSafeAppIds],
() => allApps.filter((app) => !pinnedSafeAppIds.has(app.id)),
[allApps, pinnedSafeAppIds],
)

// eslint-disable-next-line react-hooks/exhaustive-deps
Expand Down Expand Up @@ -60,7 +60,7 @@ const SafeApps: NextPage = () => {
onChangeFilterCategory={setSelectedCategories}
onChangeOptimizedWithBatch={setOptimizedWithBatchFilter}
selectedCategories={selectedCategories}
safeAppsList={remoteSafeApps}
safeAppsList={allApps}
/>

{/* Pinned apps */}
Expand Down

0 comments on commit b1f486e

Please sign in to comment.