Skip to content

Commit

Permalink
fix: scrolling while pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
aashaykapoor committed Oct 5, 2024
1 parent e2003f8 commit 1208ef3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
15 changes: 4 additions & 11 deletions packages/app-explorer/src/systems/Block/screens/BlockScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Hero } from '../components/Hero';

export const BlocksScreen = () => {
const router = useRouter();
const searchParams = useSearchParams();
const _searchParams = useSearchParams();

const [data, setData] = useState<GQLBlocksQuery['blocks'] | undefined>(
undefined,
Expand Down Expand Up @@ -76,19 +76,12 @@ export const BlocksScreen = () => {
router.push('/blocks');
return;
}
router.push(`/blocks?page=${newPageNumber}&cursor=${newCursor}`);
router.push(`/blocks?page=${newPageNumber}&cursor=${newCursor}`, {
scroll: false,
});
}
};

useEffect(() => {
const page = parseInt(searchParams.get('page') || '1');
const cursor = searchParams.get('cursor') || null;

setCurrentPage(page);
setCurrentCursor(cursor);
setDir(page > currentPage ? 'after' : 'before');
}, [searchParams]);

useEffect(() => {
fetchBlockData(currentCursor, dir);
}, [currentCursor, dir]);
Expand Down
4 changes: 2 additions & 2 deletions packages/ui/src/theme/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,7 @@
--gray-10: #7b7b7b;
--gray-11: #b4b4b4;
--gray-12: #eee;
--gray-13:#191919;
--gray-13:#212121;

--gray-a1: #00000000;
--gray-a2: #ffffff09;
Expand Down Expand Up @@ -903,7 +903,7 @@
--gray-10: oklch(58.29% 0 none);
--gray-11: oklch(76.99% 0 none);
--gray-12: oklch(94.91% 0 none);
--gray-13: oklch(25.2% 0 none);
--gray-13:#212121;

--gray-a1: color(display-p3 0 0 0 / 0);
--gray-a2: color(display-p3 1 1 1 / 0.0336);
Expand Down

0 comments on commit 1208ef3

Please sign in to comment.