Skip to content

Commit

Permalink
Merge pull request #3 from sliit-foss/fix/page-state
Browse files Browse the repository at this point in the history
Fix: reset page when filter or sort something
  • Loading branch information
Akalanka47000 authored Sep 23, 2023
2 parents 503870b + 158802a commit 027dd43
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/pages/home.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState } from "react";
import { useEffect, useState } from "react";
import { ScoreCardSkeleton } from "@/components";
import { ScoreCard } from "@/components/home";
import { filters as filterData, sorts as sortData } from "@/filters";
Expand All @@ -17,6 +17,10 @@ const Home = () => {

useTitle("Leaderboard | Bashaway");

useEffect(() => {
if (page !== 1) setPage(1);
}, [filters, sorts]);

return (
<>
<div className="w-full flex flex-col justify-center items-center gap-6 mb-8 max-w-4xl">
Expand Down

0 comments on commit 027dd43

Please sign in to comment.