Skip to content

Commit

Permalink
chore: some design improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Franqsanz committed Aug 21, 2024
1 parent 67ec6e3 commit 074eca5
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/components/AllBooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { useInView } from 'react-intersection-observer';

import { CardType } from '@components/types';
import { useBooksPaginate } from '@hooks/queries';
import { useScrollRestoration } from '@hooks/useScrollRestoration';
import { useScrollYRestoration } from '@hooks/useScrollYRestoration';
import { MySimpleGrid } from '@components/ui/MySimpleGrid';
import { Card } from '@components/cards/Card';
import { Aside } from '@components/aside/Aside';
Expand All @@ -27,7 +27,7 @@ export function AllBooks() {
useBooksPaginate();
let fetchingNextPageUI;

useScrollRestoration(isPending); // Restablece la posición del scroll al volver de la vista del libro
useScrollYRestoration(isPending); // Restablece la posición del scroll al volver de la vista del libro

useEffect(() => {
let isMounted = true;
Expand Down
1 change: 1 addition & 0 deletions src/components/aside/AboutCategories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export function AboutCategories({ category }: any) {
fontSize='sm'
maxH='250px'
overflow='auto'
pr='1'
sx={{
'&::-webkit-scrollbar': {
width: '7px',
Expand Down
8 changes: 5 additions & 3 deletions src/hooks/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,18 +212,20 @@ function useCheckUser(id: string | undefined) {
return useQuery({
queryKey: [keys.checkUser, id],
queryFn: () => getCheckUser(id),
gcTime: 24 * 3600 * 1000,
enabled: false,
refetchOnWindowFocus: false,
retry: 1,
retry: false,
});
}

function useUserData(id: string | undefined) {
return useQuery({
queryKey: [keys.userData, id],
queryFn: () => getCheckUser(id),
staleTime: 0,
retry: 4,
gcTime: 24 * 3600 * 1000,
staleTime: 24 * 3600 * 1000,
retry: 2,
});
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useLayoutEffect } from 'react';
import { useLocation } from 'react-router-dom';

export function useScrollRestoration(loading: boolean) {
export function useScrollYRestoration(loading: boolean) {
const location = useLocation();

useLayoutEffect(() => {
Expand Down
4 changes: 2 additions & 2 deletions src/pages/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
import { Card } from '@components/cards/Card';
import { CardType } from '@components/types';
import { useFilter, useFilterPaginated } from '@hooks/queries';
import { useScrollRestoration } from '@hooks/useScrollRestoration';
import { useScrollYRestoration } from '@hooks/useScrollYRestoration';
import { ContainerTitle } from '@components/layout/ContainerTitle';
import { MySimpleGrid } from '@components/ui/MySimpleGrid';
import { MainHead } from '@components/layout/Head';
Expand Down Expand Up @@ -85,7 +85,7 @@ export default function Search() {
}

const results = getNormalizedResults();
useScrollRestoration(isPendingPaginated); // Restablece la posición del scroll al volver de la vista del libro
useScrollYRestoration(isPendingPaginated); // Restablece la posición del scroll al volver de la vista del libro

useEffect(() => {
let isMounted = true;
Expand Down

0 comments on commit 074eca5

Please sign in to comment.