Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions frontend/src/ts/components/pages/account/AccountPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { createMemo, createSignal, JSXElement, Show } from "solid-js";
import {
createResultsQueryState,
getResultsQueryOnce,
getResultsSize,
Comment thread
d1rshan marked this conversation as resolved.
useResultsLiveQuery,
} from "../../../collections/results";
import { SnapshotResult } from "../../../constants/default-snapshot";
Expand Down Expand Up @@ -46,7 +45,13 @@ export function AccountPage(): JSXElement {
);
const [isExporting, setIsExporting] = createSignal(false);

const resultsQuery = useResultsLiveQuery({ queryState, sorting, limit });
const queryLimit = createMemo(() => limit() + 1);
Comment thread
d1rshan marked this conversation as resolved.
Outdated
const resultsQuery = useResultsLiveQuery({
queryState,
sorting,
limit: queryLimit,
});
const hasMoreResults = createMemo(() => resultsQuery()?.length > limit());
Comment thread
d1rshan marked this conversation as resolved.
Outdated

return (
<Show when={isAuthenticated() && isOpen()}>
Expand Down Expand Up @@ -117,15 +122,13 @@ export function AccountPage(): JSXElement {
{({ resultsQueryData }) => (
<>
<Table
data={[...resultsQueryData()]}
data={resultsQueryData().slice(0, limit())}
onSortingChange={(val) => setSorting(val)}
selectedRowId={selectedResultId}
/>
<Button
text="load more"
disabled={
resultsQuery.isLoading || getResultsSize() < limit() + 10
}
disabled={resultsQuery.isLoading || !hasMoreResults()}
onClick={() => setLimit((limit) => limit + 10)}
class="w-full text-center"
/>
Expand Down
Loading