Skip to content

Commit

Permalink
fix: remove unnecessary api call
Browse files Browse the repository at this point in the history
  • Loading branch information
apurv-wednesday committed Apr 30, 2024
1 parent 52c9625 commit 923d93a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/containers/Repos/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ const StyledLink = styled(Link)`
`;
const Repos: React.FC<RepoContainerProps> = ({ maxwidth }) => {
const router = useRouter();
const [repoName, setRepoName] = useState<string>("react");
const [repoName, setRepoName] = useState<string>("");
const [page, setPage] = useState<number>(1);

const { data, error, isLoading, isFetching } = useFetchRecommendationQuery(
isEmpty(repoName)
? skipToken
: {
repoName,
page: Number(page),
page,
},
{ skip: router.isFallback }
);
Expand All @@ -52,8 +52,8 @@ const Repos: React.FC<RepoContainerProps> = ({ maxwidth }) => {

useEffect(() => {
if (router.isReady) {
setRepoName(router.query?.search as string);
setPage(router.query?.page as unknown as number);
setRepoName((router.query?.search as string) || "");
setPage(Number(router.query?.page) || 1);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [router.isReady]);
Expand All @@ -68,7 +68,7 @@ const Repos: React.FC<RepoContainerProps> = ({ maxwidth }) => {
return (
<Container padding={20} maxwidth={500}>
<Box>
<T variant="h5">
<T>
<Trans>Recommendation</Trans>
</T>
</Box>
Expand Down

0 comments on commit 923d93a

Please sign in to comment.