Skip to content

Commit 683759c

Browse files
authored
fix usage example in overview.md (#427)
1 parent 7b36a3f commit 683759c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

docs/overview.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ The steps are to:
784784

785785
```tsx
786786
import { useLiveQuery, createCollection } from "@tanstack/react-db"
787-
import { queryCollectionOptions } from "@tanstack/electric-db-collection"
787+
import { queryCollectionOptions } from "@tanstack/query-db-collection"
788788
789789
// Load data into collections using TanStack Query.
790790
// It's common to define these in a `collections` module.
@@ -793,7 +793,7 @@ const todoCollection = createCollection(queryCollectionOptions({
793793
queryFn: async () => fetch("/api/todos"),
794794
getKey: (item) => item.id,
795795
schema: todoSchema, // any standard schema
796-
onInsert: ({ transaction }) => {
796+
onInsert: async ({ transaction }) => {
797797
const { changes: newTodo } = transaction.mutations[0]
798798
799799
// Handle the local write by sending it to your API.
@@ -805,8 +805,8 @@ const listCollection = createCollection(queryCollectionOptions({
805805
queryKey: ["todo-lists"],
806806
queryFn: async () => fetch("/api/todo-lists"),
807807
getKey: (item) => item.id,
808-
schema: todoListSchema
809-
onInsert: ({ transaction }) => {
808+
schema: todoListSchema,
809+
onInsert: async ({ transaction }) => {
810810
const { changes: newTodo } = transaction.mutations[0]
811811
812812
// Handle the local write by sending it to your API.
@@ -865,8 +865,8 @@ export const todoCollection = createCollection(electricCollectionOptions({
865865
}
866866
},
867867
getKey: (item) => item.id,
868-
schema: todoSchema
869-
onInsert: ({ transaction }) => {
868+
schema: todoSchema,
869+
onInsert: async ({ transaction }) => {
870870
const response = await api.todos.create(transaction.mutations[0].modified)
871871
872872
return { txid: response.txid}

0 commit comments

Comments
 (0)