fix: don't ddos modrinth please
This commit is contained in:
parent
e45da0d4db
commit
06aea54d6d
1 changed files with 5 additions and 3 deletions
|
|
@ -3,7 +3,7 @@ import { PackageGrid } from '@/components/content/PackageItem';
|
|||
import { useBrowserContext, useBrowserSearch } from '@/hooks/useBrowser';
|
||||
import usePagination from '@/hooks/usePagination';
|
||||
import { createFileRoute } from '@tanstack/react-router';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import { BrowserLayout } from './route';
|
||||
|
||||
export const Route = createFileRoute('/app/browser/search')({
|
||||
|
|
@ -50,9 +50,11 @@ function Results({ results }: { results: Paginated<SearchResult> }) {
|
|||
itemsPerPage: context.query.limit as unknown as number,
|
||||
});
|
||||
|
||||
const contextRef = useRef(context);
|
||||
|
||||
useEffect(() => {
|
||||
context.setQuery({ ...context.query, offset: pagination.offset as unknown as bigint });
|
||||
}, [context, pagination.offset, pagination.page]);
|
||||
contextRef.current.setQuery(query => ({ ...query, offset: pagination.offset as unknown as bigint }));
|
||||
}, [pagination.offset, pagination.page]);
|
||||
|
||||
useEffect(() => {
|
||||
if (oldTotal === results.total)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue