Skip to content

Commit

Permalink
feat: insanely speed up apps filters
Browse files Browse the repository at this point in the history
  • Loading branch information
fran-ink committed Feb 3, 2025
1 parent fd1e437 commit 923a07f
Showing 1 changed file with 7 additions and 19 deletions.
26 changes: 7 additions & 19 deletions src/app/[locale]/(dashboard)/dashboard/_components/AppsContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,25 +121,13 @@ export function AppsContent({ newLayout, currentCategory }: AppsContentProps) {
const { network, category, tags, ...params } = Object.fromEntries(
searchParams.entries()
);
const { category: newCategory, ...newParamsToUpdate } = newParams;
router.replace(
{
pathname: newLayout ? `/new/dashboard/[category]` : "/dashboard",
params: {
category: newCategory || "",
},
query: {
...params,
...newParamsToUpdate,
...(newLayout ? {} : { category: newCategory }),
},
},
{
scroll: false,
}
);
const queryParams = new URLSearchParams({
...params,
...newParams,
});
window.history.pushState("", "", `/dashboard?${queryParams}`);
},
[newLayout, searchParams, router]
[searchParams]
);
const updateFilters = useCallback(
(newFilters: Partial<InkAppFilters>) => {
Expand All @@ -151,7 +139,7 @@ export function AppsContent({ newLayout, currentCategory }: AppsContentProps) {
? { network: mergedFilters.network }
: {}),
...(mergedFilters.tags && mergedFilters.tags.length > 0
? { tags: mergedFilters.tags[0] }
? { tags: mergedFilters.tags.join(",") }
: {}),
...(mergedFilters.categories && mergedFilters.categories.length > 0
? { category: mergedFilters.categories[0] }
Expand Down

0 comments on commit 923a07f

Please sign in to comment.