Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

## [Unreleased]

### Fixed

- **`useInfiniteQuery` samples imported it from `/hooks`.** That subpath does
not re-export the hook (it is root-only). The todo app example also still
called `useInfiniteQuery(store, options)` and read `hasNextPage` /
`fetchNextPage`. The README import and the example now pass the Supabase
client and read `hasMore` / `loadMore`.

## [3.4.1] - 2026-09-16

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ and no persistence. Reach for `useQuery` first; use this only when a screen
genuinely needs cursor pagination a store's `records`/`order` can't express.

```tsx
import { useInfiniteQuery } from '@drakkar.software/anchor/hooks'
import { useInfiniteQuery } from '@drakkar.software/anchor'

function InfiniteTodoList() {
const { data, hasMore, loadMore, isLoading, isLoadingMore } = useInfiniteQuery(
Expand Down
14 changes: 8 additions & 6 deletions examples/todo-app/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ import {
eq,
query,
isPending,
useInfiniteQuery,
} from "@drakkar.software/anchor"
import { useInfiniteQuery, useLinkedQuery } from "@drakkar.software/anchor/hooks"
import { stores, todosStore } from "./stores"
import { useLinkedQuery } from "@drakkar.software/anchor/hooks"
import { stores, supabase, todosStore } from "./stores"

// ─── Auth ────────────────────────────────────────────────────────────

Expand Down Expand Up @@ -228,9 +229,10 @@ function TodoItem({
// ─── Infinite Scroll Example ─────────────────────────────────────────

function InfiniteTodoList() {
const { data, hasNextPage, fetchNextPage, isLoading } = useInfiniteQuery(
stores.todos,
const { data, hasMore, loadMore, isLoading } = useInfiniteQuery(
supabase,
{
table: "todos",
cursorColumn: "created_at",
pageSize: 20,
sort: [{ column: "created_at", ascending: false }],
Expand All @@ -249,8 +251,8 @@ function InfiniteTodoList() {
<li key={t.id}>{t.title}</li>
))}
</ul>
{hasNextPage && (
<button onClick={fetchNextPage}>Load more</button>
{hasMore && (
<button onClick={() => loadMore()}>Load more</button>
)}
</>
)}
Expand Down
2 changes: 1 addition & 1 deletion examples/todo-app/src/stores.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import type { Database } from "./database.types"
// ─── Supabase Client ─────────────────────────────────────────────────

// VITE_SUPABASE_PUBLISHABLE_KEY: sb_publishable_... (new format) or the legacy anon key
const supabase = createClient<Database>(
export const supabase = createClient<Database>(
import.meta.env.VITE_SUPABASE_URL,
import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY,
)
Expand Down
Loading