[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-tanstack-db-coremutations-optimistic":3,"mdc--w896hd-key":32,"related-repo-tanstack-db-coremutations-optimistic":5966,"related-org-tanstack-db-coremutations-optimistic":6052},{"slug":4,"name":5,"fn":6,"description":7,"org":8,"tags":12,"stars":21,"repoUrl":22,"updatedAt":23,"license":24,"forks":25,"topics":26,"repo":27,"sourceUrl":30,"mdContent":31},"db-coremutations-optimistic","db-core\u002Fmutations-optimistic","manage optimistic mutations in TanStack DB","collection.insert, collection.update (Immer-style draft proxy), collection.delete. createOptimisticAction (onMutate + mutationFn). createPacedMutations with debounceStrategy, throttleStrategy, queueStrategy. createTransaction, getActiveTransaction, ambient transaction context. Transaction lifecycle (pending\u002Fpersisting\u002Fcompleted\u002Ffailed). Mutation merging. onInsert\u002FonUpdate\u002FonDelete handlers. PendingMutation type. Transaction.isPersisted.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},"tanstack","TanStack","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Ftanstack.png",[13,17,18],{"name":14,"slug":15,"type":16},"Database","database","tag",{"name":10,"slug":9,"type":16},{"name":19,"slug":20,"type":16},"Frontend","frontend",3811,"https:\u002F\u002Fgithub.com\u002FTanStack\u002Fdb","2026-07-26T05:48:57.301803",null,245,[],{"repoUrl":22,"stars":21,"forks":25,"topics":28,"description":29},[],"The reactive client store for your API.","https:\u002F\u002Fgithub.com\u002FTanStack\u002Fdb\u002Ftree\u002FHEAD\u002Fpackages\u002Fdb\u002Fskills\u002Fdb-core\u002Fmutations-optimistic","---\nname: db-core\u002Fmutations-optimistic\ndescription: >\n  collection.insert, collection.update (Immer-style draft proxy),\n  collection.delete. createOptimisticAction (onMutate + mutationFn).\n  createPacedMutations with debounceStrategy, throttleStrategy, queueStrategy.\n  createTransaction, getActiveTransaction, ambient transaction context.\n  Transaction lifecycle (pending\u002Fpersisting\u002Fcompleted\u002Ffailed). Mutation merging.\n  onInsert\u002FonUpdate\u002FonDelete handlers. PendingMutation type. Transaction.isPersisted.\ntype: sub-skill\nlibrary: db\nlibrary_version: '0.6.0'\nsources:\n  - 'TanStack\u002Fdb:docs\u002Fguides\u002Fmutations.md'\n  - 'TanStack\u002Fdb:packages\u002Fdb\u002Fsrc\u002Ftransactions.ts'\n  - 'TanStack\u002Fdb:packages\u002Fdb\u002Fsrc\u002Foptimistic-action.ts'\n  - 'TanStack\u002Fdb:packages\u002Fdb\u002Fsrc\u002Fpaced-mutations.ts'\n---\n\n# Mutations & Optimistic State\n\n> **Depends on:** `db-core\u002Fcollection-setup` -- you need a configured collection\n> (with `getKey`, sync adapter, and optionally `onInsert`\u002F`onUpdate`\u002F`onDelete`\n> handlers) before you can mutate.\n\nTanStack DB mutations follow a unidirectional loop:\n**optimistic mutation -> handler persists to backend -> sync back -> confirmed state**.\nOptimistic state is applied in the current tick and dropped when the handler resolves.\n\n---\n\n## Setup -- Collection Write Operations\n\n### insert\n\n```ts\n\u002F\u002F Single item\ntodoCollection.insert({\n  id: crypto.randomUUID(),\n  text: 'Buy groceries',\n  completed: false,\n})\n\n\u002F\u002F Multiple items\ntodoCollection.insert([\n  { id: crypto.randomUUID(), text: 'Buy groceries', completed: false },\n  { id: crypto.randomUUID(), text: 'Walk dog', completed: false },\n])\n\n\u002F\u002F With metadata \u002F non-optimistic\ntodoCollection.insert(item, { metadata: { source: 'import' } })\ntodoCollection.insert(item, { optimistic: false })\n```\n\n### update (Immer-style draft proxy)\n\n```ts\n\u002F\u002F Single item -- mutate the draft, do NOT reassign it\ntodoCollection.update(todo.id, (draft) => {\n  draft.completed = true\n  draft.completedAt = new Date()\n})\n\n\u002F\u002F Multiple items\ntodoCollection.update([id1, id2], (drafts) => {\n  drafts.forEach((d) => {\n    d.completed = true\n  })\n})\n\n\u002F\u002F With metadata\ntodoCollection.update(\n  todo.id,\n  { metadata: { reason: 'user-edit' } },\n  (draft) => {\n    draft.text = 'Updated'\n  },\n)\n```\n\n### delete\n\n```ts\ntodoCollection.delete(todo.id)\ntodoCollection.delete([id1, id2])\ntodoCollection.delete(todo.id, { metadata: { reason: 'completed' } })\n```\n\nAll three return a `Transaction` object. Use `tx.isPersisted.promise` to await\npersistence or catch rollback errors.\n\n---\n\n## Core Patterns\n\n### 1. createOptimisticAction -- intent-based mutations\n\nUse when the optimistic change is a _guess_ at how the server will transform\nthe data, or when you need to mutate multiple collections atomically.\n\n```ts\nimport { createOptimisticAction } from '@tanstack\u002Fdb'\n\nconst likePost = createOptimisticAction\u003Cstring>({\n  \u002F\u002F MUST be synchronous -- applied in the current tick\n  onMutate: (postId) => {\n    postCollection.update(postId, (draft) => {\n      draft.likeCount += 1\n      draft.likedByMe = true\n    })\n  },\n  mutationFn: async (postId, { transaction }) => {\n    await api.posts.like(postId)\n    \u002F\u002F IMPORTANT: wait for server state to sync back before returning\n    await postCollection.utils.refetch()\n  },\n})\n\n\u002F\u002F Returns a Transaction\nconst tx = likePost(postId)\nawait tx.isPersisted.promise\n```\n\nMulti-collection example:\n\n```ts\nconst createProject = createOptimisticAction\u003C{ name: string; ownerId: string }>(\n  {\n    onMutate: ({ name, ownerId }) => {\n      projectCollection.insert({ id: crypto.randomUUID(), name, ownerId })\n      userCollection.update(ownerId, (d) => {\n        d.projectCount += 1\n      })\n    },\n    mutationFn: async ({ name, ownerId }) => {\n      await api.projects.create({ name, ownerId })\n      await Promise.all([\n        projectCollection.utils.refetch(),\n        userCollection.utils.refetch(),\n      ])\n    },\n  },\n)\n```\n\n### 2. createPacedMutations -- auto-save with debounce \u002F throttle \u002F queue\n\n```ts\nimport { createPacedMutations, debounceStrategy } from '@tanstack\u002Fdb'\n\nconst autoSaveNote = createPacedMutations\u003Cstring>({\n  onMutate: (text) => {\n    noteCollection.update(noteId, (draft) => {\n      draft.body = text\n    })\n  },\n  mutationFn: async ({ transaction }) => {\n    const mutation = transaction.mutations[0]\n    await api.notes.update(mutation.key, mutation.changes)\n    await noteCollection.utils.refetch()\n  },\n  strategy: debounceStrategy({ wait: 500 }),\n})\n\n\u002F\u002F Each call resets the debounce timer; mutations merge into one transaction\nautoSaveNote('Hello')\nautoSaveNote('Hello, world') \u002F\u002F only this version persists\n```\n\nOther strategies:\n\n```ts\nimport { throttleStrategy, queueStrategy } from '@tanstack\u002Fdb'\n\n\u002F\u002F Evenly spaced (sliders, scroll)\nthrottleStrategy({ wait: 200, leading: true, trailing: true })\n\n\u002F\u002F Sequential FIFO -- every mutation persisted in order\nqueueStrategy({ wait: 0, maxSize: 100 })\n```\n\n### 3. createTransaction -- manual batching\n\n```ts\nimport { createTransaction } from '@tanstack\u002Fdb'\n\nconst tx = createTransaction({\n  autoCommit: false, \u002F\u002F wait for explicit commit()\n  mutationFn: async ({ transaction }) => {\n    await api.batchUpdate(transaction.mutations)\n  },\n})\n\ntx.mutate(() => {\n  todoCollection.update(id1, (d) => {\n    d.status = 'reviewed'\n  })\n  todoCollection.update(id2, (d) => {\n    d.status = 'reviewed'\n  })\n})\n\n\u002F\u002F User reviews... then commits or rolls back\nawait tx.commit()\n\u002F\u002F OR: tx.rollback()\n```\n\nInside `tx.mutate(() => { ... })`, the transaction is pushed onto an ambient\nstack. Any `collection.insert\u002Fupdate\u002Fdelete` call joins the ambient transaction\nautomatically via `getActiveTransaction()`.\n\nFor mutations captured by a manual transaction, collection-level\n`onInsert`\u002F`onUpdate`\u002F`onDelete` handlers are not invoked automatically. The\nmanual transaction's `mutationFn` is responsible for persisting\n`transaction.mutations`. This makes `createTransaction({ autoCommit: false })`\na good fit for draft-style flows where local state updates immediately but the\nserver call waits for Save\u002FBlur; call `tx.rollback()` to discard the optimistic\nchanges.\n\n### 4. Mutation handlers with automatic refetch (QueryCollection pattern)\n\n```ts\nconst todoCollection = createCollection(\n  queryCollectionOptions({\n    queryKey: ['todos'],\n    queryFn: () => api.todos.getAll(),\n    getKey: (t) => t.id,\n    onInsert: async ({ transaction }) => {\n      await Promise.all(\n        transaction.mutations.map((m) => api.todos.create(m.modified)),\n      )\n      \u002F\u002F Query Collection refetches after the handler completes and awaits it.\n    },\n    onUpdate: async ({ transaction }) => {\n      await Promise.all(\n        transaction.mutations.map((m) =>\n          api.todos.update(m.original.id, m.changes),\n        ),\n      )\n    },\n    onDelete: async ({ transaction }) => {\n      await Promise.all(\n        transaction.mutations.map((m) => api.todos.delete(m.original.id)),\n      )\n    },\n  }),\n)\n```\n\nFor ElectricCollection, return `{ txid }` instead of refetching:\n\n```ts\nonUpdate: async ({ transaction }) => {\n  const txids = await Promise.all(\n    transaction.mutations.map(async (m) => {\n      const res = await api.todos.update(m.original.id, m.changes)\n      return res.txid\n    }),\n  )\n  return { txid: txids }\n}\n```\n\n---\n\n## Common Mistakes\n\n### CRITICAL: Passing an object to update() instead of a draft callback\n\n```ts\n\u002F\u002F WRONG -- silently fails or throws\ncollection.update(id, { ...item, title: 'new' })\n\n\u002F\u002F CORRECT -- mutate the draft proxy\ncollection.update(id, (draft) => {\n  draft.title = 'new'\n})\n```\n\n### CRITICAL: Hallucinating mutation API signatures\n\nThe most common AI-generated errors:\n\n- Inventing handler signatures (e.g. `onMutate` on a collection config)\n- Confusing `createOptimisticAction` with `createTransaction`\n- Wrong PendingMutation property names (`mutation.data` does not exist --\n  use `mutation.modified`, `mutation.changes`, `mutation.original`)\n- Missing the ambient transaction pattern\n\nAlways reference the exact types in `references\u002Ftransaction-api.md`.\n\n### CRITICAL: onMutate returning a Promise\n\n`onMutate` in `createOptimisticAction` **must be synchronous**. Optimistic state\nis applied in the current tick. Returning a Promise throws\n`OnMutateMustBeSynchronousError`.\n\n```ts\n\u002F\u002F WRONG\ncreateOptimisticAction({\n  onMutate: async (text) => {\n    collection.insert({ id: await generateId(), text })\n  },\n  ...\n})\n\n\u002F\u002F CORRECT\ncreateOptimisticAction({\n  onMutate: (text) => {\n    collection.insert({ id: crypto.randomUUID(), text })\n  },\n  ...\n})\n```\n\n### CRITICAL: Mutations without handler or ambient transaction\n\nCollection mutations require either:\n\n1. An `onInsert`\u002F`onUpdate`\u002F`onDelete` handler on the collection, OR\n2. An ambient transaction from `createTransaction`\u002F`createOptimisticAction`\n\nWithout either, throws `MissingInsertHandlerError` (or the Update\u002FDelete variant).\n\n### HIGH: Calling .mutate() after transaction is no longer pending\n\nTransactions only accept new mutations while in `pending` state. Calling\n`mutate()` after `commit()` or `rollback()` throws\n`TransactionNotPendingMutateError`. Create a new transaction instead.\n\n### HIGH: Changing primary key via update\n\nThe update proxy detects key changes and throws `KeyUpdateNotAllowedError`.\nPrimary keys are immutable once set. If you need a different key, delete and\nre-insert.\n\n### HIGH: Inserting item with duplicate key\n\nIf an item with the same key already exists (synced or optimistic), throws\n`DuplicateKeyError`. Always generate a unique key (e.g. `crypto.randomUUID()`)\nor check before inserting.\n\n### HIGH: Manually refetching inside a Query Collection handler\n\nQuery Collection automatically refetches after `onInsert`, `onUpdate`, and\n`onDelete` complete, and waits for that refetch before the mutation finishes.\nCalling `utils.refetch()` inside the handler sends a redundant request.\n\n```ts\n\u002F\u002F WRONG -- causes one manual and one automatic refetch\nonInsert: async ({ transaction }) => {\n  await api.createTodo(transaction.mutations[0].modified)\n  await collection.utils.refetch()\n}\n\n\u002F\u002F CORRECT -- automatic refetch is awaited after this returns\nonInsert: async ({ transaction }) => {\n  await api.createTodo(transaction.mutations[0].modified)\n}\n```\n\nWhen the handler writes the confirmed server result with direct-write utilities,\nreturn `{ refetch: false }` to skip the automatic refetch.\n\n---\n\n## Tension: Optimistic Speed vs. Data Consistency\n\nInstant optimistic updates create a window where client state diverges from\nserver state. If the handler fails, the rollback removes the optimistic state --\nwhich can discard user work the user thought was saved. Consider:\n\n- Showing pending\u002Fsaving indicators so users know state is unconfirmed\n- Using `{ optimistic: false }` for destructive operations\n- Designing idempotent server endpoints so retries are safe\n- Handling `tx.isPersisted.promise` rejection to surface errors to the user\n\n---\n\n## References\n\n- [Transaction API Reference](references\u002Ftransaction-api.md) -- createTransaction config,\n  Transaction object, PendingMutation type, mutation merging rules, strategy types\n- [TanStack DB Mutations Guide](https:\u002F\u002Ftanstack.com\u002Fdb\u002Flatest\u002Fdocs\u002Fguides\u002Fmutations)\n",{"data":33,"body":42},{"name":5,"description":7,"type":34,"library":35,"library_version":36,"sources":37},"sub-skill","db","0.6.0",[38,39,40,41],"TanStack\u002Fdb:docs\u002Fguides\u002Fmutations.md","TanStack\u002Fdb:packages\u002Fdb\u002Fsrc\u002Ftransactions.ts","TanStack\u002Fdb:packages\u002Fdb\u002Fsrc\u002Foptimistic-action.ts","TanStack\u002Fdb:packages\u002Fdb\u002Fsrc\u002Fpaced-mutations.ts",{"type":43,"children":44},"root",[45,54,110,122,126,133,139,654,660,1148,1153,1295,1316,1319,1325,1331,1344,1829,1834,2343,2349,2896,2901,3110,3116,3593,3621,3677,3683,4437,4450,4750,4753,4759,4765,4954,4960,4965,5042,5054,5060,5090,5391,5397,5402,5446,5459,5465,5510,5516,5529,5535,5556,5562,5595,5861,5874,5877,5883,5888,5926,5929,5935,5960],{"type":46,"tag":47,"props":48,"children":50},"element","h1",{"id":49},"mutations-optimistic-state",[51],{"type":52,"value":53},"text","Mutations & Optimistic State",{"type":46,"tag":55,"props":56,"children":57},"blockquote",{},[58],{"type":46,"tag":59,"props":60,"children":61},"p",{},[62,68,70,77,79,85,87,93,95,101,102,108],{"type":46,"tag":63,"props":64,"children":65},"strong",{},[66],{"type":52,"value":67},"Depends on:",{"type":52,"value":69}," ",{"type":46,"tag":71,"props":72,"children":74},"code",{"className":73},[],[75],{"type":52,"value":76},"db-core\u002Fcollection-setup",{"type":52,"value":78}," -- you need a configured collection\n(with ",{"type":46,"tag":71,"props":80,"children":82},{"className":81},[],[83],{"type":52,"value":84},"getKey",{"type":52,"value":86},", sync adapter, and optionally ",{"type":46,"tag":71,"props":88,"children":90},{"className":89},[],[91],{"type":52,"value":92},"onInsert",{"type":52,"value":94},"\u002F",{"type":46,"tag":71,"props":96,"children":98},{"className":97},[],[99],{"type":52,"value":100},"onUpdate",{"type":52,"value":94},{"type":46,"tag":71,"props":103,"children":105},{"className":104},[],[106],{"type":52,"value":107},"onDelete",{"type":52,"value":109},"\nhandlers) before you can mutate.",{"type":46,"tag":59,"props":111,"children":112},{},[113,115,120],{"type":52,"value":114},"TanStack DB mutations follow a unidirectional loop:\n",{"type":46,"tag":63,"props":116,"children":117},{},[118],{"type":52,"value":119},"optimistic mutation -> handler persists to backend -> sync back -> confirmed state",{"type":52,"value":121},".\nOptimistic state is applied in the current tick and dropped when the handler resolves.",{"type":46,"tag":123,"props":124,"children":125},"hr",{},[],{"type":46,"tag":127,"props":128,"children":130},"h2",{"id":129},"setup-collection-write-operations",[131],{"type":52,"value":132},"Setup -- Collection Write Operations",{"type":46,"tag":134,"props":135,"children":137},"h3",{"id":136},"insert",[138],{"type":52,"value":136},{"type":46,"tag":140,"props":141,"children":146},"pre",{"className":142,"code":143,"language":144,"meta":145,"style":145},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","\u002F\u002F Single item\ntodoCollection.insert({\n  id: crypto.randomUUID(),\n  text: 'Buy groceries',\n  completed: false,\n})\n\n\u002F\u002F Multiple items\ntodoCollection.insert([\n  { id: crypto.randomUUID(), text: 'Buy groceries', completed: false },\n  { id: crypto.randomUUID(), text: 'Walk dog', completed: false },\n])\n\n\u002F\u002F With metadata \u002F non-optimistic\ntodoCollection.insert(item, { metadata: { source: 'import' } })\ntodoCollection.insert(item, { optimistic: false })\n","ts","",[147],{"type":46,"tag":71,"props":148,"children":149},{"__ignoreMap":145},[150,162,193,232,265,288,302,312,321,342,424,501,510,518,527,605],{"type":46,"tag":151,"props":152,"children":155},"span",{"class":153,"line":154},"line",1,[156],{"type":46,"tag":151,"props":157,"children":159},{"style":158},"--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic",[160],{"type":52,"value":161},"\u002F\u002F Single item\n",{"type":46,"tag":151,"props":163,"children":165},{"class":153,"line":164},2,[166,172,178,183,188],{"type":46,"tag":151,"props":167,"children":169},{"style":168},"--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8",[170],{"type":52,"value":171},"todoCollection",{"type":46,"tag":151,"props":173,"children":175},{"style":174},"--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF",[176],{"type":52,"value":177},".",{"type":46,"tag":151,"props":179,"children":181},{"style":180},"--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF",[182],{"type":52,"value":136},{"type":46,"tag":151,"props":184,"children":185},{"style":168},[186],{"type":52,"value":187},"(",{"type":46,"tag":151,"props":189,"children":190},{"style":174},[191],{"type":52,"value":192},"{\n",{"type":46,"tag":151,"props":194,"children":196},{"class":153,"line":195},3,[197,203,208,213,217,222,227],{"type":46,"tag":151,"props":198,"children":200},{"style":199},"--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178",[201],{"type":52,"value":202},"  id",{"type":46,"tag":151,"props":204,"children":205},{"style":174},[206],{"type":52,"value":207},":",{"type":46,"tag":151,"props":209,"children":210},{"style":168},[211],{"type":52,"value":212}," crypto",{"type":46,"tag":151,"props":214,"children":215},{"style":174},[216],{"type":52,"value":177},{"type":46,"tag":151,"props":218,"children":219},{"style":180},[220],{"type":52,"value":221},"randomUUID",{"type":46,"tag":151,"props":223,"children":224},{"style":168},[225],{"type":52,"value":226},"()",{"type":46,"tag":151,"props":228,"children":229},{"style":174},[230],{"type":52,"value":231},",\n",{"type":46,"tag":151,"props":233,"children":235},{"class":153,"line":234},4,[236,241,245,250,256,261],{"type":46,"tag":151,"props":237,"children":238},{"style":199},[239],{"type":52,"value":240},"  text",{"type":46,"tag":151,"props":242,"children":243},{"style":174},[244],{"type":52,"value":207},{"type":46,"tag":151,"props":246,"children":247},{"style":174},[248],{"type":52,"value":249}," '",{"type":46,"tag":151,"props":251,"children":253},{"style":252},"--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D",[254],{"type":52,"value":255},"Buy groceries",{"type":46,"tag":151,"props":257,"children":258},{"style":174},[259],{"type":52,"value":260},"'",{"type":46,"tag":151,"props":262,"children":263},{"style":174},[264],{"type":52,"value":231},{"type":46,"tag":151,"props":266,"children":268},{"class":153,"line":267},5,[269,274,278,284],{"type":46,"tag":151,"props":270,"children":271},{"style":199},[272],{"type":52,"value":273},"  completed",{"type":46,"tag":151,"props":275,"children":276},{"style":174},[277],{"type":52,"value":207},{"type":46,"tag":151,"props":279,"children":281},{"style":280},"--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC",[282],{"type":52,"value":283}," false",{"type":46,"tag":151,"props":285,"children":286},{"style":174},[287],{"type":52,"value":231},{"type":46,"tag":151,"props":289,"children":291},{"class":153,"line":290},6,[292,297],{"type":46,"tag":151,"props":293,"children":294},{"style":174},[295],{"type":52,"value":296},"}",{"type":46,"tag":151,"props":298,"children":299},{"style":168},[300],{"type":52,"value":301},")\n",{"type":46,"tag":151,"props":303,"children":305},{"class":153,"line":304},7,[306],{"type":46,"tag":151,"props":307,"children":309},{"emptyLinePlaceholder":308},true,[310],{"type":52,"value":311},"\n",{"type":46,"tag":151,"props":313,"children":315},{"class":153,"line":314},8,[316],{"type":46,"tag":151,"props":317,"children":318},{"style":158},[319],{"type":52,"value":320},"\u002F\u002F Multiple items\n",{"type":46,"tag":151,"props":322,"children":324},{"class":153,"line":323},9,[325,329,333,337],{"type":46,"tag":151,"props":326,"children":327},{"style":168},[328],{"type":52,"value":171},{"type":46,"tag":151,"props":330,"children":331},{"style":174},[332],{"type":52,"value":177},{"type":46,"tag":151,"props":334,"children":335},{"style":180},[336],{"type":52,"value":136},{"type":46,"tag":151,"props":338,"children":339},{"style":168},[340],{"type":52,"value":341},"([\n",{"type":46,"tag":151,"props":343,"children":345},{"class":153,"line":344},10,[346,351,356,360,364,368,372,376,381,386,390,394,398,402,406,411,415,419],{"type":46,"tag":151,"props":347,"children":348},{"style":174},[349],{"type":52,"value":350},"  {",{"type":46,"tag":151,"props":352,"children":353},{"style":199},[354],{"type":52,"value":355}," id",{"type":46,"tag":151,"props":357,"children":358},{"style":174},[359],{"type":52,"value":207},{"type":46,"tag":151,"props":361,"children":362},{"style":168},[363],{"type":52,"value":212},{"type":46,"tag":151,"props":365,"children":366},{"style":174},[367],{"type":52,"value":177},{"type":46,"tag":151,"props":369,"children":370},{"style":180},[371],{"type":52,"value":221},{"type":46,"tag":151,"props":373,"children":374},{"style":168},[375],{"type":52,"value":226},{"type":46,"tag":151,"props":377,"children":378},{"style":174},[379],{"type":52,"value":380},",",{"type":46,"tag":151,"props":382,"children":383},{"style":199},[384],{"type":52,"value":385}," text",{"type":46,"tag":151,"props":387,"children":388},{"style":174},[389],{"type":52,"value":207},{"type":46,"tag":151,"props":391,"children":392},{"style":174},[393],{"type":52,"value":249},{"type":46,"tag":151,"props":395,"children":396},{"style":252},[397],{"type":52,"value":255},{"type":46,"tag":151,"props":399,"children":400},{"style":174},[401],{"type":52,"value":260},{"type":46,"tag":151,"props":403,"children":404},{"style":174},[405],{"type":52,"value":380},{"type":46,"tag":151,"props":407,"children":408},{"style":199},[409],{"type":52,"value":410}," completed",{"type":46,"tag":151,"props":412,"children":413},{"style":174},[414],{"type":52,"value":207},{"type":46,"tag":151,"props":416,"children":417},{"style":280},[418],{"type":52,"value":283},{"type":46,"tag":151,"props":420,"children":421},{"style":174},[422],{"type":52,"value":423}," },\n",{"type":46,"tag":151,"props":425,"children":427},{"class":153,"line":426},11,[428,432,436,440,444,448,452,456,460,464,468,472,477,481,485,489,493,497],{"type":46,"tag":151,"props":429,"children":430},{"style":174},[431],{"type":52,"value":350},{"type":46,"tag":151,"props":433,"children":434},{"style":199},[435],{"type":52,"value":355},{"type":46,"tag":151,"props":437,"children":438},{"style":174},[439],{"type":52,"value":207},{"type":46,"tag":151,"props":441,"children":442},{"style":168},[443],{"type":52,"value":212},{"type":46,"tag":151,"props":445,"children":446},{"style":174},[447],{"type":52,"value":177},{"type":46,"tag":151,"props":449,"children":450},{"style":180},[451],{"type":52,"value":221},{"type":46,"tag":151,"props":453,"children":454},{"style":168},[455],{"type":52,"value":226},{"type":46,"tag":151,"props":457,"children":458},{"style":174},[459],{"type":52,"value":380},{"type":46,"tag":151,"props":461,"children":462},{"style":199},[463],{"type":52,"value":385},{"type":46,"tag":151,"props":465,"children":466},{"style":174},[467],{"type":52,"value":207},{"type":46,"tag":151,"props":469,"children":470},{"style":174},[471],{"type":52,"value":249},{"type":46,"tag":151,"props":473,"children":474},{"style":252},[475],{"type":52,"value":476},"Walk dog",{"type":46,"tag":151,"props":478,"children":479},{"style":174},[480],{"type":52,"value":260},{"type":46,"tag":151,"props":482,"children":483},{"style":174},[484],{"type":52,"value":380},{"type":46,"tag":151,"props":486,"children":487},{"style":199},[488],{"type":52,"value":410},{"type":46,"tag":151,"props":490,"children":491},{"style":174},[492],{"type":52,"value":207},{"type":46,"tag":151,"props":494,"children":495},{"style":280},[496],{"type":52,"value":283},{"type":46,"tag":151,"props":498,"children":499},{"style":174},[500],{"type":52,"value":423},{"type":46,"tag":151,"props":502,"children":504},{"class":153,"line":503},12,[505],{"type":46,"tag":151,"props":506,"children":507},{"style":168},[508],{"type":52,"value":509},"])\n",{"type":46,"tag":151,"props":511,"children":513},{"class":153,"line":512},13,[514],{"type":46,"tag":151,"props":515,"children":516},{"emptyLinePlaceholder":308},[517],{"type":52,"value":311},{"type":46,"tag":151,"props":519,"children":521},{"class":153,"line":520},14,[522],{"type":46,"tag":151,"props":523,"children":524},{"style":158},[525],{"type":52,"value":526},"\u002F\u002F With metadata \u002F non-optimistic\n",{"type":46,"tag":151,"props":528,"children":530},{"class":153,"line":529},15,[531,535,539,543,548,552,557,562,566,570,575,579,583,588,592,597,601],{"type":46,"tag":151,"props":532,"children":533},{"style":168},[534],{"type":52,"value":171},{"type":46,"tag":151,"props":536,"children":537},{"style":174},[538],{"type":52,"value":177},{"type":46,"tag":151,"props":540,"children":541},{"style":180},[542],{"type":52,"value":136},{"type":46,"tag":151,"props":544,"children":545},{"style":168},[546],{"type":52,"value":547},"(item",{"type":46,"tag":151,"props":549,"children":550},{"style":174},[551],{"type":52,"value":380},{"type":46,"tag":151,"props":553,"children":554},{"style":174},[555],{"type":52,"value":556}," {",{"type":46,"tag":151,"props":558,"children":559},{"style":199},[560],{"type":52,"value":561}," metadata",{"type":46,"tag":151,"props":563,"children":564},{"style":174},[565],{"type":52,"value":207},{"type":46,"tag":151,"props":567,"children":568},{"style":174},[569],{"type":52,"value":556},{"type":46,"tag":151,"props":571,"children":572},{"style":199},[573],{"type":52,"value":574}," source",{"type":46,"tag":151,"props":576,"children":577},{"style":174},[578],{"type":52,"value":207},{"type":46,"tag":151,"props":580,"children":581},{"style":174},[582],{"type":52,"value":249},{"type":46,"tag":151,"props":584,"children":585},{"style":252},[586],{"type":52,"value":587},"import",{"type":46,"tag":151,"props":589,"children":590},{"style":174},[591],{"type":52,"value":260},{"type":46,"tag":151,"props":593,"children":594},{"style":174},[595],{"type":52,"value":596}," }",{"type":46,"tag":151,"props":598,"children":599},{"style":174},[600],{"type":52,"value":596},{"type":46,"tag":151,"props":602,"children":603},{"style":168},[604],{"type":52,"value":301},{"type":46,"tag":151,"props":606,"children":608},{"class":153,"line":607},16,[609,613,617,621,625,629,633,638,642,646,650],{"type":46,"tag":151,"props":610,"children":611},{"style":168},[612],{"type":52,"value":171},{"type":46,"tag":151,"props":614,"children":615},{"style":174},[616],{"type":52,"value":177},{"type":46,"tag":151,"props":618,"children":619},{"style":180},[620],{"type":52,"value":136},{"type":46,"tag":151,"props":622,"children":623},{"style":168},[624],{"type":52,"value":547},{"type":46,"tag":151,"props":626,"children":627},{"style":174},[628],{"type":52,"value":380},{"type":46,"tag":151,"props":630,"children":631},{"style":174},[632],{"type":52,"value":556},{"type":46,"tag":151,"props":634,"children":635},{"style":199},[636],{"type":52,"value":637}," optimistic",{"type":46,"tag":151,"props":639,"children":640},{"style":174},[641],{"type":52,"value":207},{"type":46,"tag":151,"props":643,"children":644},{"style":280},[645],{"type":52,"value":283},{"type":46,"tag":151,"props":647,"children":648},{"style":174},[649],{"type":52,"value":596},{"type":46,"tag":151,"props":651,"children":652},{"style":168},[653],{"type":52,"value":301},{"type":46,"tag":134,"props":655,"children":657},{"id":656},"update-immer-style-draft-proxy",[658],{"type":52,"value":659},"update (Immer-style draft proxy)",{"type":46,"tag":140,"props":661,"children":663},{"className":142,"code":662,"language":144,"meta":145,"style":145},"\u002F\u002F Single item -- mutate the draft, do NOT reassign it\ntodoCollection.update(todo.id, (draft) => {\n  draft.completed = true\n  draft.completedAt = new Date()\n})\n\n\u002F\u002F Multiple items\ntodoCollection.update([id1, id2], (drafts) => {\n  drafts.forEach((d) => {\n    d.completed = true\n  })\n})\n\n\u002F\u002F With metadata\ntodoCollection.update(\n  todo.id,\n  { metadata: { reason: 'user-edit' } },\n  (draft) => {\n    draft.text = 'Updated'\n  },\n)\n",[664],{"type":46,"tag":71,"props":665,"children":666},{"__ignoreMap":145},[667,675,736,763,798,809,816,823,877,919,943,955,966,973,981,1001,1021,1071,1096,1131,1140],{"type":46,"tag":151,"props":668,"children":669},{"class":153,"line":154},[670],{"type":46,"tag":151,"props":671,"children":672},{"style":158},[673],{"type":52,"value":674},"\u002F\u002F Single item -- mutate the draft, do NOT reassign it\n",{"type":46,"tag":151,"props":676,"children":677},{"class":153,"line":164},[678,682,686,691,696,700,705,709,714,720,725,731],{"type":46,"tag":151,"props":679,"children":680},{"style":168},[681],{"type":52,"value":171},{"type":46,"tag":151,"props":683,"children":684},{"style":174},[685],{"type":52,"value":177},{"type":46,"tag":151,"props":687,"children":688},{"style":180},[689],{"type":52,"value":690},"update",{"type":46,"tag":151,"props":692,"children":693},{"style":168},[694],{"type":52,"value":695},"(todo",{"type":46,"tag":151,"props":697,"children":698},{"style":174},[699],{"type":52,"value":177},{"type":46,"tag":151,"props":701,"children":702},{"style":168},[703],{"type":52,"value":704},"id",{"type":46,"tag":151,"props":706,"children":707},{"style":174},[708],{"type":52,"value":380},{"type":46,"tag":151,"props":710,"children":711},{"style":174},[712],{"type":52,"value":713}," (",{"type":46,"tag":151,"props":715,"children":717},{"style":716},"--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic",[718],{"type":52,"value":719},"draft",{"type":46,"tag":151,"props":721,"children":722},{"style":174},[723],{"type":52,"value":724},")",{"type":46,"tag":151,"props":726,"children":728},{"style":727},"--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA",[729],{"type":52,"value":730}," =>",{"type":46,"tag":151,"props":732,"children":733},{"style":174},[734],{"type":52,"value":735}," {\n",{"type":46,"tag":151,"props":737,"children":738},{"class":153,"line":195},[739,744,748,753,758],{"type":46,"tag":151,"props":740,"children":741},{"style":168},[742],{"type":52,"value":743},"  draft",{"type":46,"tag":151,"props":745,"children":746},{"style":174},[747],{"type":52,"value":177},{"type":46,"tag":151,"props":749,"children":750},{"style":168},[751],{"type":52,"value":752},"completed",{"type":46,"tag":151,"props":754,"children":755},{"style":174},[756],{"type":52,"value":757}," =",{"type":46,"tag":151,"props":759,"children":760},{"style":280},[761],{"type":52,"value":762}," true\n",{"type":46,"tag":151,"props":764,"children":765},{"class":153,"line":234},[766,770,774,779,783,788,793],{"type":46,"tag":151,"props":767,"children":768},{"style":168},[769],{"type":52,"value":743},{"type":46,"tag":151,"props":771,"children":772},{"style":174},[773],{"type":52,"value":177},{"type":46,"tag":151,"props":775,"children":776},{"style":168},[777],{"type":52,"value":778},"completedAt",{"type":46,"tag":151,"props":780,"children":781},{"style":174},[782],{"type":52,"value":757},{"type":46,"tag":151,"props":784,"children":785},{"style":174},[786],{"type":52,"value":787}," new",{"type":46,"tag":151,"props":789,"children":790},{"style":180},[791],{"type":52,"value":792}," Date",{"type":46,"tag":151,"props":794,"children":795},{"style":199},[796],{"type":52,"value":797},"()\n",{"type":46,"tag":151,"props":799,"children":800},{"class":153,"line":267},[801,805],{"type":46,"tag":151,"props":802,"children":803},{"style":174},[804],{"type":52,"value":296},{"type":46,"tag":151,"props":806,"children":807},{"style":168},[808],{"type":52,"value":301},{"type":46,"tag":151,"props":810,"children":811},{"class":153,"line":290},[812],{"type":46,"tag":151,"props":813,"children":814},{"emptyLinePlaceholder":308},[815],{"type":52,"value":311},{"type":46,"tag":151,"props":817,"children":818},{"class":153,"line":304},[819],{"type":46,"tag":151,"props":820,"children":821},{"style":158},[822],{"type":52,"value":320},{"type":46,"tag":151,"props":824,"children":825},{"class":153,"line":314},[826,830,834,838,843,847,852,856,860,865,869,873],{"type":46,"tag":151,"props":827,"children":828},{"style":168},[829],{"type":52,"value":171},{"type":46,"tag":151,"props":831,"children":832},{"style":174},[833],{"type":52,"value":177},{"type":46,"tag":151,"props":835,"children":836},{"style":180},[837],{"type":52,"value":690},{"type":46,"tag":151,"props":839,"children":840},{"style":168},[841],{"type":52,"value":842},"([id1",{"type":46,"tag":151,"props":844,"children":845},{"style":174},[846],{"type":52,"value":380},{"type":46,"tag":151,"props":848,"children":849},{"style":168},[850],{"type":52,"value":851}," id2]",{"type":46,"tag":151,"props":853,"children":854},{"style":174},[855],{"type":52,"value":380},{"type":46,"tag":151,"props":857,"children":858},{"style":174},[859],{"type":52,"value":713},{"type":46,"tag":151,"props":861,"children":862},{"style":716},[863],{"type":52,"value":864},"drafts",{"type":46,"tag":151,"props":866,"children":867},{"style":174},[868],{"type":52,"value":724},{"type":46,"tag":151,"props":870,"children":871},{"style":727},[872],{"type":52,"value":730},{"type":46,"tag":151,"props":874,"children":875},{"style":174},[876],{"type":52,"value":735},{"type":46,"tag":151,"props":878,"children":879},{"class":153,"line":323},[880,885,889,894,898,902,907,911,915],{"type":46,"tag":151,"props":881,"children":882},{"style":168},[883],{"type":52,"value":884},"  drafts",{"type":46,"tag":151,"props":886,"children":887},{"style":174},[888],{"type":52,"value":177},{"type":46,"tag":151,"props":890,"children":891},{"style":180},[892],{"type":52,"value":893},"forEach",{"type":46,"tag":151,"props":895,"children":896},{"style":199},[897],{"type":52,"value":187},{"type":46,"tag":151,"props":899,"children":900},{"style":174},[901],{"type":52,"value":187},{"type":46,"tag":151,"props":903,"children":904},{"style":716},[905],{"type":52,"value":906},"d",{"type":46,"tag":151,"props":908,"children":909},{"style":174},[910],{"type":52,"value":724},{"type":46,"tag":151,"props":912,"children":913},{"style":727},[914],{"type":52,"value":730},{"type":46,"tag":151,"props":916,"children":917},{"style":174},[918],{"type":52,"value":735},{"type":46,"tag":151,"props":920,"children":921},{"class":153,"line":344},[922,927,931,935,939],{"type":46,"tag":151,"props":923,"children":924},{"style":168},[925],{"type":52,"value":926},"    d",{"type":46,"tag":151,"props":928,"children":929},{"style":174},[930],{"type":52,"value":177},{"type":46,"tag":151,"props":932,"children":933},{"style":168},[934],{"type":52,"value":752},{"type":46,"tag":151,"props":936,"children":937},{"style":174},[938],{"type":52,"value":757},{"type":46,"tag":151,"props":940,"children":941},{"style":280},[942],{"type":52,"value":762},{"type":46,"tag":151,"props":944,"children":945},{"class":153,"line":426},[946,951],{"type":46,"tag":151,"props":947,"children":948},{"style":174},[949],{"type":52,"value":950},"  }",{"type":46,"tag":151,"props":952,"children":953},{"style":199},[954],{"type":52,"value":301},{"type":46,"tag":151,"props":956,"children":957},{"class":153,"line":503},[958,962],{"type":46,"tag":151,"props":959,"children":960},{"style":174},[961],{"type":52,"value":296},{"type":46,"tag":151,"props":963,"children":964},{"style":168},[965],{"type":52,"value":301},{"type":46,"tag":151,"props":967,"children":968},{"class":153,"line":512},[969],{"type":46,"tag":151,"props":970,"children":971},{"emptyLinePlaceholder":308},[972],{"type":52,"value":311},{"type":46,"tag":151,"props":974,"children":975},{"class":153,"line":520},[976],{"type":46,"tag":151,"props":977,"children":978},{"style":158},[979],{"type":52,"value":980},"\u002F\u002F With metadata\n",{"type":46,"tag":151,"props":982,"children":983},{"class":153,"line":529},[984,988,992,996],{"type":46,"tag":151,"props":985,"children":986},{"style":168},[987],{"type":52,"value":171},{"type":46,"tag":151,"props":989,"children":990},{"style":174},[991],{"type":52,"value":177},{"type":46,"tag":151,"props":993,"children":994},{"style":180},[995],{"type":52,"value":690},{"type":46,"tag":151,"props":997,"children":998},{"style":168},[999],{"type":52,"value":1000},"(\n",{"type":46,"tag":151,"props":1002,"children":1003},{"class":153,"line":607},[1004,1009,1013,1017],{"type":46,"tag":151,"props":1005,"children":1006},{"style":168},[1007],{"type":52,"value":1008},"  todo",{"type":46,"tag":151,"props":1010,"children":1011},{"style":174},[1012],{"type":52,"value":177},{"type":46,"tag":151,"props":1014,"children":1015},{"style":168},[1016],{"type":52,"value":704},{"type":46,"tag":151,"props":1018,"children":1019},{"style":174},[1020],{"type":52,"value":231},{"type":46,"tag":151,"props":1022,"children":1024},{"class":153,"line":1023},17,[1025,1029,1033,1037,1041,1046,1050,1054,1059,1063,1067],{"type":46,"tag":151,"props":1026,"children":1027},{"style":174},[1028],{"type":52,"value":350},{"type":46,"tag":151,"props":1030,"children":1031},{"style":199},[1032],{"type":52,"value":561},{"type":46,"tag":151,"props":1034,"children":1035},{"style":174},[1036],{"type":52,"value":207},{"type":46,"tag":151,"props":1038,"children":1039},{"style":174},[1040],{"type":52,"value":556},{"type":46,"tag":151,"props":1042,"children":1043},{"style":199},[1044],{"type":52,"value":1045}," reason",{"type":46,"tag":151,"props":1047,"children":1048},{"style":174},[1049],{"type":52,"value":207},{"type":46,"tag":151,"props":1051,"children":1052},{"style":174},[1053],{"type":52,"value":249},{"type":46,"tag":151,"props":1055,"children":1056},{"style":252},[1057],{"type":52,"value":1058},"user-edit",{"type":46,"tag":151,"props":1060,"children":1061},{"style":174},[1062],{"type":52,"value":260},{"type":46,"tag":151,"props":1064,"children":1065},{"style":174},[1066],{"type":52,"value":596},{"type":46,"tag":151,"props":1068,"children":1069},{"style":174},[1070],{"type":52,"value":423},{"type":46,"tag":151,"props":1072,"children":1074},{"class":153,"line":1073},18,[1075,1080,1084,1088,1092],{"type":46,"tag":151,"props":1076,"children":1077},{"style":174},[1078],{"type":52,"value":1079},"  (",{"type":46,"tag":151,"props":1081,"children":1082},{"style":716},[1083],{"type":52,"value":719},{"type":46,"tag":151,"props":1085,"children":1086},{"style":174},[1087],{"type":52,"value":724},{"type":46,"tag":151,"props":1089,"children":1090},{"style":727},[1091],{"type":52,"value":730},{"type":46,"tag":151,"props":1093,"children":1094},{"style":174},[1095],{"type":52,"value":735},{"type":46,"tag":151,"props":1097,"children":1099},{"class":153,"line":1098},19,[1100,1105,1109,1113,1117,1121,1126],{"type":46,"tag":151,"props":1101,"children":1102},{"style":168},[1103],{"type":52,"value":1104},"    draft",{"type":46,"tag":151,"props":1106,"children":1107},{"style":174},[1108],{"type":52,"value":177},{"type":46,"tag":151,"props":1110,"children":1111},{"style":168},[1112],{"type":52,"value":52},{"type":46,"tag":151,"props":1114,"children":1115},{"style":174},[1116],{"type":52,"value":757},{"type":46,"tag":151,"props":1118,"children":1119},{"style":174},[1120],{"type":52,"value":249},{"type":46,"tag":151,"props":1122,"children":1123},{"style":252},[1124],{"type":52,"value":1125},"Updated",{"type":46,"tag":151,"props":1127,"children":1128},{"style":174},[1129],{"type":52,"value":1130},"'\n",{"type":46,"tag":151,"props":1132,"children":1134},{"class":153,"line":1133},20,[1135],{"type":46,"tag":151,"props":1136,"children":1137},{"style":174},[1138],{"type":52,"value":1139},"  },\n",{"type":46,"tag":151,"props":1141,"children":1143},{"class":153,"line":1142},21,[1144],{"type":46,"tag":151,"props":1145,"children":1146},{"style":168},[1147],{"type":52,"value":301},{"type":46,"tag":134,"props":1149,"children":1151},{"id":1150},"delete",[1152],{"type":52,"value":1150},{"type":46,"tag":140,"props":1154,"children":1156},{"className":142,"code":1155,"language":144,"meta":145,"style":145},"todoCollection.delete(todo.id)\ntodoCollection.delete([id1, id2])\ntodoCollection.delete(todo.id, { metadata: { reason: 'completed' } })\n",[1157],{"type":46,"tag":71,"props":1158,"children":1159},{"__ignoreMap":145},[1160,1188,1216],{"type":46,"tag":151,"props":1161,"children":1162},{"class":153,"line":154},[1163,1167,1171,1175,1179,1183],{"type":46,"tag":151,"props":1164,"children":1165},{"style":168},[1166],{"type":52,"value":171},{"type":46,"tag":151,"props":1168,"children":1169},{"style":174},[1170],{"type":52,"value":177},{"type":46,"tag":151,"props":1172,"children":1173},{"style":180},[1174],{"type":52,"value":1150},{"type":46,"tag":151,"props":1176,"children":1177},{"style":168},[1178],{"type":52,"value":695},{"type":46,"tag":151,"props":1180,"children":1181},{"style":174},[1182],{"type":52,"value":177},{"type":46,"tag":151,"props":1184,"children":1185},{"style":168},[1186],{"type":52,"value":1187},"id)\n",{"type":46,"tag":151,"props":1189,"children":1190},{"class":153,"line":164},[1191,1195,1199,1203,1207,1211],{"type":46,"tag":151,"props":1192,"children":1193},{"style":168},[1194],{"type":52,"value":171},{"type":46,"tag":151,"props":1196,"children":1197},{"style":174},[1198],{"type":52,"value":177},{"type":46,"tag":151,"props":1200,"children":1201},{"style":180},[1202],{"type":52,"value":1150},{"type":46,"tag":151,"props":1204,"children":1205},{"style":168},[1206],{"type":52,"value":842},{"type":46,"tag":151,"props":1208,"children":1209},{"style":174},[1210],{"type":52,"value":380},{"type":46,"tag":151,"props":1212,"children":1213},{"style":168},[1214],{"type":52,"value":1215}," id2])\n",{"type":46,"tag":151,"props":1217,"children":1218},{"class":153,"line":195},[1219,1223,1227,1231,1235,1239,1243,1247,1251,1255,1259,1263,1267,1271,1275,1279,1283,1287,1291],{"type":46,"tag":151,"props":1220,"children":1221},{"style":168},[1222],{"type":52,"value":171},{"type":46,"tag":151,"props":1224,"children":1225},{"style":174},[1226],{"type":52,"value":177},{"type":46,"tag":151,"props":1228,"children":1229},{"style":180},[1230],{"type":52,"value":1150},{"type":46,"tag":151,"props":1232,"children":1233},{"style":168},[1234],{"type":52,"value":695},{"type":46,"tag":151,"props":1236,"children":1237},{"style":174},[1238],{"type":52,"value":177},{"type":46,"tag":151,"props":1240,"children":1241},{"style":168},[1242],{"type":52,"value":704},{"type":46,"tag":151,"props":1244,"children":1245},{"style":174},[1246],{"type":52,"value":380},{"type":46,"tag":151,"props":1248,"children":1249},{"style":174},[1250],{"type":52,"value":556},{"type":46,"tag":151,"props":1252,"children":1253},{"style":199},[1254],{"type":52,"value":561},{"type":46,"tag":151,"props":1256,"children":1257},{"style":174},[1258],{"type":52,"value":207},{"type":46,"tag":151,"props":1260,"children":1261},{"style":174},[1262],{"type":52,"value":556},{"type":46,"tag":151,"props":1264,"children":1265},{"style":199},[1266],{"type":52,"value":1045},{"type":46,"tag":151,"props":1268,"children":1269},{"style":174},[1270],{"type":52,"value":207},{"type":46,"tag":151,"props":1272,"children":1273},{"style":174},[1274],{"type":52,"value":249},{"type":46,"tag":151,"props":1276,"children":1277},{"style":252},[1278],{"type":52,"value":752},{"type":46,"tag":151,"props":1280,"children":1281},{"style":174},[1282],{"type":52,"value":260},{"type":46,"tag":151,"props":1284,"children":1285},{"style":174},[1286],{"type":52,"value":596},{"type":46,"tag":151,"props":1288,"children":1289},{"style":174},[1290],{"type":52,"value":596},{"type":46,"tag":151,"props":1292,"children":1293},{"style":168},[1294],{"type":52,"value":301},{"type":46,"tag":59,"props":1296,"children":1297},{},[1298,1300,1306,1308,1314],{"type":52,"value":1299},"All three return a ",{"type":46,"tag":71,"props":1301,"children":1303},{"className":1302},[],[1304],{"type":52,"value":1305},"Transaction",{"type":52,"value":1307}," object. Use ",{"type":46,"tag":71,"props":1309,"children":1311},{"className":1310},[],[1312],{"type":52,"value":1313},"tx.isPersisted.promise",{"type":52,"value":1315}," to await\npersistence or catch rollback errors.",{"type":46,"tag":123,"props":1317,"children":1318},{},[],{"type":46,"tag":127,"props":1320,"children":1322},{"id":1321},"core-patterns",[1323],{"type":52,"value":1324},"Core Patterns",{"type":46,"tag":134,"props":1326,"children":1328},{"id":1327},"_1-createoptimisticaction-intent-based-mutations",[1329],{"type":52,"value":1330},"1. createOptimisticAction -- intent-based mutations",{"type":46,"tag":59,"props":1332,"children":1333},{},[1334,1336,1342],{"type":52,"value":1335},"Use when the optimistic change is a ",{"type":46,"tag":1337,"props":1338,"children":1339},"em",{},[1340],{"type":52,"value":1341},"guess",{"type":52,"value":1343}," at how the server will transform\nthe data, or when you need to mutate multiple collections atomically.",{"type":46,"tag":140,"props":1345,"children":1347},{"className":142,"code":1346,"language":144,"meta":145,"style":145},"import { createOptimisticAction } from '@tanstack\u002Fdb'\n\nconst likePost = createOptimisticAction\u003Cstring>({\n  \u002F\u002F MUST be synchronous -- applied in the current tick\n  onMutate: (postId) => {\n    postCollection.update(postId, (draft) => {\n      draft.likeCount += 1\n      draft.likedByMe = true\n    })\n  },\n  mutationFn: async (postId, { transaction }) => {\n    await api.posts.like(postId)\n    \u002F\u002F IMPORTANT: wait for server state to sync back before returning\n    await postCollection.utils.refetch()\n  },\n})\n\n\u002F\u002F Returns a Transaction\nconst tx = likePost(postId)\nawait tx.isPersisted.promise\n",[1348],{"type":46,"tag":71,"props":1349,"children":1350},{"__ignoreMap":145},[1351,1390,1397,1443,1451,1484,1532,1560,1584,1596,1603,1654,1697,1705,1739,1746,1757,1764,1772,1798],{"type":46,"tag":151,"props":1352,"children":1353},{"class":153,"line":154},[1354,1359,1363,1368,1372,1377,1381,1386],{"type":46,"tag":151,"props":1355,"children":1357},{"style":1356},"--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic",[1358],{"type":52,"value":587},{"type":46,"tag":151,"props":1360,"children":1361},{"style":174},[1362],{"type":52,"value":556},{"type":46,"tag":151,"props":1364,"children":1365},{"style":168},[1366],{"type":52,"value":1367}," createOptimisticAction",{"type":46,"tag":151,"props":1369,"children":1370},{"style":174},[1371],{"type":52,"value":596},{"type":46,"tag":151,"props":1373,"children":1374},{"style":1356},[1375],{"type":52,"value":1376}," from",{"type":46,"tag":151,"props":1378,"children":1379},{"style":174},[1380],{"type":52,"value":249},{"type":46,"tag":151,"props":1382,"children":1383},{"style":252},[1384],{"type":52,"value":1385},"@tanstack\u002Fdb",{"type":46,"tag":151,"props":1387,"children":1388},{"style":174},[1389],{"type":52,"value":1130},{"type":46,"tag":151,"props":1391,"children":1392},{"class":153,"line":164},[1393],{"type":46,"tag":151,"props":1394,"children":1395},{"emptyLinePlaceholder":308},[1396],{"type":52,"value":311},{"type":46,"tag":151,"props":1398,"children":1399},{"class":153,"line":195},[1400,1405,1410,1415,1419,1424,1430,1435,1439],{"type":46,"tag":151,"props":1401,"children":1402},{"style":727},[1403],{"type":52,"value":1404},"const",{"type":46,"tag":151,"props":1406,"children":1407},{"style":168},[1408],{"type":52,"value":1409}," likePost ",{"type":46,"tag":151,"props":1411,"children":1412},{"style":174},[1413],{"type":52,"value":1414},"=",{"type":46,"tag":151,"props":1416,"children":1417},{"style":180},[1418],{"type":52,"value":1367},{"type":46,"tag":151,"props":1420,"children":1421},{"style":174},[1422],{"type":52,"value":1423},"\u003C",{"type":46,"tag":151,"props":1425,"children":1427},{"style":1426},"--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B",[1428],{"type":52,"value":1429},"string",{"type":46,"tag":151,"props":1431,"children":1432},{"style":174},[1433],{"type":52,"value":1434},">",{"type":46,"tag":151,"props":1436,"children":1437},{"style":168},[1438],{"type":52,"value":187},{"type":46,"tag":151,"props":1440,"children":1441},{"style":174},[1442],{"type":52,"value":192},{"type":46,"tag":151,"props":1444,"children":1445},{"class":153,"line":234},[1446],{"type":46,"tag":151,"props":1447,"children":1448},{"style":158},[1449],{"type":52,"value":1450},"  \u002F\u002F MUST be synchronous -- applied in the current tick\n",{"type":46,"tag":151,"props":1452,"children":1453},{"class":153,"line":267},[1454,1459,1463,1467,1472,1476,1480],{"type":46,"tag":151,"props":1455,"children":1456},{"style":180},[1457],{"type":52,"value":1458},"  onMutate",{"type":46,"tag":151,"props":1460,"children":1461},{"style":174},[1462],{"type":52,"value":207},{"type":46,"tag":151,"props":1464,"children":1465},{"style":174},[1466],{"type":52,"value":713},{"type":46,"tag":151,"props":1468,"children":1469},{"style":716},[1470],{"type":52,"value":1471},"postId",{"type":46,"tag":151,"props":1473,"children":1474},{"style":174},[1475],{"type":52,"value":724},{"type":46,"tag":151,"props":1477,"children":1478},{"style":727},[1479],{"type":52,"value":730},{"type":46,"tag":151,"props":1481,"children":1482},{"style":174},[1483],{"type":52,"value":735},{"type":46,"tag":151,"props":1485,"children":1486},{"class":153,"line":290},[1487,1492,1496,1500,1504,1508,1512,1516,1520,1524,1528],{"type":46,"tag":151,"props":1488,"children":1489},{"style":168},[1490],{"type":52,"value":1491},"    postCollection",{"type":46,"tag":151,"props":1493,"children":1494},{"style":174},[1495],{"type":52,"value":177},{"type":46,"tag":151,"props":1497,"children":1498},{"style":180},[1499],{"type":52,"value":690},{"type":46,"tag":151,"props":1501,"children":1502},{"style":199},[1503],{"type":52,"value":187},{"type":46,"tag":151,"props":1505,"children":1506},{"style":168},[1507],{"type":52,"value":1471},{"type":46,"tag":151,"props":1509,"children":1510},{"style":174},[1511],{"type":52,"value":380},{"type":46,"tag":151,"props":1513,"children":1514},{"style":174},[1515],{"type":52,"value":713},{"type":46,"tag":151,"props":1517,"children":1518},{"style":716},[1519],{"type":52,"value":719},{"type":46,"tag":151,"props":1521,"children":1522},{"style":174},[1523],{"type":52,"value":724},{"type":46,"tag":151,"props":1525,"children":1526},{"style":727},[1527],{"type":52,"value":730},{"type":46,"tag":151,"props":1529,"children":1530},{"style":174},[1531],{"type":52,"value":735},{"type":46,"tag":151,"props":1533,"children":1534},{"class":153,"line":304},[1535,1540,1544,1549,1554],{"type":46,"tag":151,"props":1536,"children":1537},{"style":168},[1538],{"type":52,"value":1539},"      draft",{"type":46,"tag":151,"props":1541,"children":1542},{"style":174},[1543],{"type":52,"value":177},{"type":46,"tag":151,"props":1545,"children":1546},{"style":168},[1547],{"type":52,"value":1548},"likeCount",{"type":46,"tag":151,"props":1550,"children":1551},{"style":174},[1552],{"type":52,"value":1553}," +=",{"type":46,"tag":151,"props":1555,"children":1557},{"style":1556},"--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C",[1558],{"type":52,"value":1559}," 1\n",{"type":46,"tag":151,"props":1561,"children":1562},{"class":153,"line":314},[1563,1567,1571,1576,1580],{"type":46,"tag":151,"props":1564,"children":1565},{"style":168},[1566],{"type":52,"value":1539},{"type":46,"tag":151,"props":1568,"children":1569},{"style":174},[1570],{"type":52,"value":177},{"type":46,"tag":151,"props":1572,"children":1573},{"style":168},[1574],{"type":52,"value":1575},"likedByMe",{"type":46,"tag":151,"props":1577,"children":1578},{"style":174},[1579],{"type":52,"value":757},{"type":46,"tag":151,"props":1581,"children":1582},{"style":280},[1583],{"type":52,"value":762},{"type":46,"tag":151,"props":1585,"children":1586},{"class":153,"line":323},[1587,1592],{"type":46,"tag":151,"props":1588,"children":1589},{"style":174},[1590],{"type":52,"value":1591},"    }",{"type":46,"tag":151,"props":1593,"children":1594},{"style":199},[1595],{"type":52,"value":301},{"type":46,"tag":151,"props":1597,"children":1598},{"class":153,"line":344},[1599],{"type":46,"tag":151,"props":1600,"children":1601},{"style":174},[1602],{"type":52,"value":1139},{"type":46,"tag":151,"props":1604,"children":1605},{"class":153,"line":426},[1606,1611,1615,1620,1624,1628,1632,1636,1641,1646,1650],{"type":46,"tag":151,"props":1607,"children":1608},{"style":180},[1609],{"type":52,"value":1610},"  mutationFn",{"type":46,"tag":151,"props":1612,"children":1613},{"style":174},[1614],{"type":52,"value":207},{"type":46,"tag":151,"props":1616,"children":1617},{"style":727},[1618],{"type":52,"value":1619}," async",{"type":46,"tag":151,"props":1621,"children":1622},{"style":174},[1623],{"type":52,"value":713},{"type":46,"tag":151,"props":1625,"children":1626},{"style":716},[1627],{"type":52,"value":1471},{"type":46,"tag":151,"props":1629,"children":1630},{"style":174},[1631],{"type":52,"value":380},{"type":46,"tag":151,"props":1633,"children":1634},{"style":174},[1635],{"type":52,"value":556},{"type":46,"tag":151,"props":1637,"children":1638},{"style":716},[1639],{"type":52,"value":1640}," transaction",{"type":46,"tag":151,"props":1642,"children":1643},{"style":174},[1644],{"type":52,"value":1645}," })",{"type":46,"tag":151,"props":1647,"children":1648},{"style":727},[1649],{"type":52,"value":730},{"type":46,"tag":151,"props":1651,"children":1652},{"style":174},[1653],{"type":52,"value":735},{"type":46,"tag":151,"props":1655,"children":1656},{"class":153,"line":503},[1657,1662,1667,1671,1676,1680,1685,1689,1693],{"type":46,"tag":151,"props":1658,"children":1659},{"style":1356},[1660],{"type":52,"value":1661},"    await",{"type":46,"tag":151,"props":1663,"children":1664},{"style":168},[1665],{"type":52,"value":1666}," api",{"type":46,"tag":151,"props":1668,"children":1669},{"style":174},[1670],{"type":52,"value":177},{"type":46,"tag":151,"props":1672,"children":1673},{"style":168},[1674],{"type":52,"value":1675},"posts",{"type":46,"tag":151,"props":1677,"children":1678},{"style":174},[1679],{"type":52,"value":177},{"type":46,"tag":151,"props":1681,"children":1682},{"style":180},[1683],{"type":52,"value":1684},"like",{"type":46,"tag":151,"props":1686,"children":1687},{"style":199},[1688],{"type":52,"value":187},{"type":46,"tag":151,"props":1690,"children":1691},{"style":168},[1692],{"type":52,"value":1471},{"type":46,"tag":151,"props":1694,"children":1695},{"style":199},[1696],{"type":52,"value":301},{"type":46,"tag":151,"props":1698,"children":1699},{"class":153,"line":512},[1700],{"type":46,"tag":151,"props":1701,"children":1702},{"style":158},[1703],{"type":52,"value":1704},"    \u002F\u002F IMPORTANT: wait for server state to sync back before returning\n",{"type":46,"tag":151,"props":1706,"children":1707},{"class":153,"line":520},[1708,1712,1717,1721,1726,1730,1735],{"type":46,"tag":151,"props":1709,"children":1710},{"style":1356},[1711],{"type":52,"value":1661},{"type":46,"tag":151,"props":1713,"children":1714},{"style":168},[1715],{"type":52,"value":1716}," postCollection",{"type":46,"tag":151,"props":1718,"children":1719},{"style":174},[1720],{"type":52,"value":177},{"type":46,"tag":151,"props":1722,"children":1723},{"style":168},[1724],{"type":52,"value":1725},"utils",{"type":46,"tag":151,"props":1727,"children":1728},{"style":174},[1729],{"type":52,"value":177},{"type":46,"tag":151,"props":1731,"children":1732},{"style":180},[1733],{"type":52,"value":1734},"refetch",{"type":46,"tag":151,"props":1736,"children":1737},{"style":199},[1738],{"type":52,"value":797},{"type":46,"tag":151,"props":1740,"children":1741},{"class":153,"line":529},[1742],{"type":46,"tag":151,"props":1743,"children":1744},{"style":174},[1745],{"type":52,"value":1139},{"type":46,"tag":151,"props":1747,"children":1748},{"class":153,"line":607},[1749,1753],{"type":46,"tag":151,"props":1750,"children":1751},{"style":174},[1752],{"type":52,"value":296},{"type":46,"tag":151,"props":1754,"children":1755},{"style":168},[1756],{"type":52,"value":301},{"type":46,"tag":151,"props":1758,"children":1759},{"class":153,"line":1023},[1760],{"type":46,"tag":151,"props":1761,"children":1762},{"emptyLinePlaceholder":308},[1763],{"type":52,"value":311},{"type":46,"tag":151,"props":1765,"children":1766},{"class":153,"line":1073},[1767],{"type":46,"tag":151,"props":1768,"children":1769},{"style":158},[1770],{"type":52,"value":1771},"\u002F\u002F Returns a Transaction\n",{"type":46,"tag":151,"props":1773,"children":1774},{"class":153,"line":1098},[1775,1779,1784,1788,1793],{"type":46,"tag":151,"props":1776,"children":1777},{"style":727},[1778],{"type":52,"value":1404},{"type":46,"tag":151,"props":1780,"children":1781},{"style":168},[1782],{"type":52,"value":1783}," tx ",{"type":46,"tag":151,"props":1785,"children":1786},{"style":174},[1787],{"type":52,"value":1414},{"type":46,"tag":151,"props":1789,"children":1790},{"style":180},[1791],{"type":52,"value":1792}," likePost",{"type":46,"tag":151,"props":1794,"children":1795},{"style":168},[1796],{"type":52,"value":1797},"(postId)\n",{"type":46,"tag":151,"props":1799,"children":1800},{"class":153,"line":1133},[1801,1806,1811,1815,1820,1824],{"type":46,"tag":151,"props":1802,"children":1803},{"style":1356},[1804],{"type":52,"value":1805},"await",{"type":46,"tag":151,"props":1807,"children":1808},{"style":168},[1809],{"type":52,"value":1810}," tx",{"type":46,"tag":151,"props":1812,"children":1813},{"style":174},[1814],{"type":52,"value":177},{"type":46,"tag":151,"props":1816,"children":1817},{"style":168},[1818],{"type":52,"value":1819},"isPersisted",{"type":46,"tag":151,"props":1821,"children":1822},{"style":174},[1823],{"type":52,"value":177},{"type":46,"tag":151,"props":1825,"children":1826},{"style":168},[1827],{"type":52,"value":1828},"promise\n",{"type":46,"tag":59,"props":1830,"children":1831},{},[1832],{"type":52,"value":1833},"Multi-collection example:",{"type":46,"tag":140,"props":1835,"children":1837},{"className":142,"code":1836,"language":144,"meta":145,"style":145},"const createProject = createOptimisticAction\u003C{ name: string; ownerId: string }>(\n  {\n    onMutate: ({ name, ownerId }) => {\n      projectCollection.insert({ id: crypto.randomUUID(), name, ownerId })\n      userCollection.update(ownerId, (d) => {\n        d.projectCount += 1\n      })\n    },\n    mutationFn: async ({ name, ownerId }) => {\n      await api.projects.create({ name, ownerId })\n      await Promise.all([\n        projectCollection.utils.refetch(),\n        userCollection.utils.refetch(),\n      ])\n    },\n  },\n)\n",[1838],{"type":46,"tag":71,"props":1839,"children":1840},{"__ignoreMap":145},[1841,1907,1915,1956,2029,2078,2103,2115,2123,2167,2225,2250,2282,2314,2322,2329,2336],{"type":46,"tag":151,"props":1842,"children":1843},{"class":153,"line":154},[1844,1848,1853,1857,1861,1866,1871,1875,1880,1885,1890,1894,1898,1903],{"type":46,"tag":151,"props":1845,"children":1846},{"style":727},[1847],{"type":52,"value":1404},{"type":46,"tag":151,"props":1849,"children":1850},{"style":168},[1851],{"type":52,"value":1852}," createProject ",{"type":46,"tag":151,"props":1854,"children":1855},{"style":174},[1856],{"type":52,"value":1414},{"type":46,"tag":151,"props":1858,"children":1859},{"style":180},[1860],{"type":52,"value":1367},{"type":46,"tag":151,"props":1862,"children":1863},{"style":174},[1864],{"type":52,"value":1865},"\u003C{",{"type":46,"tag":151,"props":1867,"children":1868},{"style":199},[1869],{"type":52,"value":1870}," name",{"type":46,"tag":151,"props":1872,"children":1873},{"style":174},[1874],{"type":52,"value":207},{"type":46,"tag":151,"props":1876,"children":1877},{"style":1426},[1878],{"type":52,"value":1879}," string",{"type":46,"tag":151,"props":1881,"children":1882},{"style":174},[1883],{"type":52,"value":1884},";",{"type":46,"tag":151,"props":1886,"children":1887},{"style":199},[1888],{"type":52,"value":1889}," ownerId",{"type":46,"tag":151,"props":1891,"children":1892},{"style":174},[1893],{"type":52,"value":207},{"type":46,"tag":151,"props":1895,"children":1896},{"style":1426},[1897],{"type":52,"value":1879},{"type":46,"tag":151,"props":1899,"children":1900},{"style":174},[1901],{"type":52,"value":1902}," }>",{"type":46,"tag":151,"props":1904,"children":1905},{"style":168},[1906],{"type":52,"value":1000},{"type":46,"tag":151,"props":1908,"children":1909},{"class":153,"line":164},[1910],{"type":46,"tag":151,"props":1911,"children":1912},{"style":174},[1913],{"type":52,"value":1914},"  {\n",{"type":46,"tag":151,"props":1916,"children":1917},{"class":153,"line":195},[1918,1923,1927,1932,1936,1940,1944,1948,1952],{"type":46,"tag":151,"props":1919,"children":1920},{"style":180},[1921],{"type":52,"value":1922},"    onMutate",{"type":46,"tag":151,"props":1924,"children":1925},{"style":174},[1926],{"type":52,"value":207},{"type":46,"tag":151,"props":1928,"children":1929},{"style":174},[1930],{"type":52,"value":1931}," ({",{"type":46,"tag":151,"props":1933,"children":1934},{"style":716},[1935],{"type":52,"value":1870},{"type":46,"tag":151,"props":1937,"children":1938},{"style":174},[1939],{"type":52,"value":380},{"type":46,"tag":151,"props":1941,"children":1942},{"style":716},[1943],{"type":52,"value":1889},{"type":46,"tag":151,"props":1945,"children":1946},{"style":174},[1947],{"type":52,"value":1645},{"type":46,"tag":151,"props":1949,"children":1950},{"style":727},[1951],{"type":52,"value":730},{"type":46,"tag":151,"props":1953,"children":1954},{"style":174},[1955],{"type":52,"value":735},{"type":46,"tag":151,"props":1957,"children":1958},{"class":153,"line":234},[1959,1964,1968,1972,1976,1981,1985,1989,1993,1997,2001,2005,2009,2013,2017,2021,2025],{"type":46,"tag":151,"props":1960,"children":1961},{"style":168},[1962],{"type":52,"value":1963},"      projectCollection",{"type":46,"tag":151,"props":1965,"children":1966},{"style":174},[1967],{"type":52,"value":177},{"type":46,"tag":151,"props":1969,"children":1970},{"style":180},[1971],{"type":52,"value":136},{"type":46,"tag":151,"props":1973,"children":1974},{"style":199},[1975],{"type":52,"value":187},{"type":46,"tag":151,"props":1977,"children":1978},{"style":174},[1979],{"type":52,"value":1980},"{",{"type":46,"tag":151,"props":1982,"children":1983},{"style":199},[1984],{"type":52,"value":355},{"type":46,"tag":151,"props":1986,"children":1987},{"style":174},[1988],{"type":52,"value":207},{"type":46,"tag":151,"props":1990,"children":1991},{"style":168},[1992],{"type":52,"value":212},{"type":46,"tag":151,"props":1994,"children":1995},{"style":174},[1996],{"type":52,"value":177},{"type":46,"tag":151,"props":1998,"children":1999},{"style":180},[2000],{"type":52,"value":221},{"type":46,"tag":151,"props":2002,"children":2003},{"style":199},[2004],{"type":52,"value":226},{"type":46,"tag":151,"props":2006,"children":2007},{"style":174},[2008],{"type":52,"value":380},{"type":46,"tag":151,"props":2010,"children":2011},{"style":168},[2012],{"type":52,"value":1870},{"type":46,"tag":151,"props":2014,"children":2015},{"style":174},[2016],{"type":52,"value":380},{"type":46,"tag":151,"props":2018,"children":2019},{"style":168},[2020],{"type":52,"value":1889},{"type":46,"tag":151,"props":2022,"children":2023},{"style":174},[2024],{"type":52,"value":596},{"type":46,"tag":151,"props":2026,"children":2027},{"style":199},[2028],{"type":52,"value":301},{"type":46,"tag":151,"props":2030,"children":2031},{"class":153,"line":267},[2032,2037,2041,2045,2049,2054,2058,2062,2066,2070,2074],{"type":46,"tag":151,"props":2033,"children":2034},{"style":168},[2035],{"type":52,"value":2036},"      userCollection",{"type":46,"tag":151,"props":2038,"children":2039},{"style":174},[2040],{"type":52,"value":177},{"type":46,"tag":151,"props":2042,"children":2043},{"style":180},[2044],{"type":52,"value":690},{"type":46,"tag":151,"props":2046,"children":2047},{"style":199},[2048],{"type":52,"value":187},{"type":46,"tag":151,"props":2050,"children":2051},{"style":168},[2052],{"type":52,"value":2053},"ownerId",{"type":46,"tag":151,"props":2055,"children":2056},{"style":174},[2057],{"type":52,"value":380},{"type":46,"tag":151,"props":2059,"children":2060},{"style":174},[2061],{"type":52,"value":713},{"type":46,"tag":151,"props":2063,"children":2064},{"style":716},[2065],{"type":52,"value":906},{"type":46,"tag":151,"props":2067,"children":2068},{"style":174},[2069],{"type":52,"value":724},{"type":46,"tag":151,"props":2071,"children":2072},{"style":727},[2073],{"type":52,"value":730},{"type":46,"tag":151,"props":2075,"children":2076},{"style":174},[2077],{"type":52,"value":735},{"type":46,"tag":151,"props":2079,"children":2080},{"class":153,"line":290},[2081,2086,2090,2095,2099],{"type":46,"tag":151,"props":2082,"children":2083},{"style":168},[2084],{"type":52,"value":2085},"        d",{"type":46,"tag":151,"props":2087,"children":2088},{"style":174},[2089],{"type":52,"value":177},{"type":46,"tag":151,"props":2091,"children":2092},{"style":168},[2093],{"type":52,"value":2094},"projectCount",{"type":46,"tag":151,"props":2096,"children":2097},{"style":174},[2098],{"type":52,"value":1553},{"type":46,"tag":151,"props":2100,"children":2101},{"style":1556},[2102],{"type":52,"value":1559},{"type":46,"tag":151,"props":2104,"children":2105},{"class":153,"line":304},[2106,2111],{"type":46,"tag":151,"props":2107,"children":2108},{"style":174},[2109],{"type":52,"value":2110},"      }",{"type":46,"tag":151,"props":2112,"children":2113},{"style":199},[2114],{"type":52,"value":301},{"type":46,"tag":151,"props":2116,"children":2117},{"class":153,"line":314},[2118],{"type":46,"tag":151,"props":2119,"children":2120},{"style":174},[2121],{"type":52,"value":2122},"    },\n",{"type":46,"tag":151,"props":2124,"children":2125},{"class":153,"line":323},[2126,2131,2135,2139,2143,2147,2151,2155,2159,2163],{"type":46,"tag":151,"props":2127,"children":2128},{"style":180},[2129],{"type":52,"value":2130},"    mutationFn",{"type":46,"tag":151,"props":2132,"children":2133},{"style":174},[2134],{"type":52,"value":207},{"type":46,"tag":151,"props":2136,"children":2137},{"style":727},[2138],{"type":52,"value":1619},{"type":46,"tag":151,"props":2140,"children":2141},{"style":174},[2142],{"type":52,"value":1931},{"type":46,"tag":151,"props":2144,"children":2145},{"style":716},[2146],{"type":52,"value":1870},{"type":46,"tag":151,"props":2148,"children":2149},{"style":174},[2150],{"type":52,"value":380},{"type":46,"tag":151,"props":2152,"children":2153},{"style":716},[2154],{"type":52,"value":1889},{"type":46,"tag":151,"props":2156,"children":2157},{"style":174},[2158],{"type":52,"value":1645},{"type":46,"tag":151,"props":2160,"children":2161},{"style":727},[2162],{"type":52,"value":730},{"type":46,"tag":151,"props":2164,"children":2165},{"style":174},[2166],{"type":52,"value":735},{"type":46,"tag":151,"props":2168,"children":2169},{"class":153,"line":344},[2170,2175,2179,2183,2188,2192,2197,2201,2205,2209,2213,2217,2221],{"type":46,"tag":151,"props":2171,"children":2172},{"style":1356},[2173],{"type":52,"value":2174},"      await",{"type":46,"tag":151,"props":2176,"children":2177},{"style":168},[2178],{"type":52,"value":1666},{"type":46,"tag":151,"props":2180,"children":2181},{"style":174},[2182],{"type":52,"value":177},{"type":46,"tag":151,"props":2184,"children":2185},{"style":168},[2186],{"type":52,"value":2187},"projects",{"type":46,"tag":151,"props":2189,"children":2190},{"style":174},[2191],{"type":52,"value":177},{"type":46,"tag":151,"props":2193,"children":2194},{"style":180},[2195],{"type":52,"value":2196},"create",{"type":46,"tag":151,"props":2198,"children":2199},{"style":199},[2200],{"type":52,"value":187},{"type":46,"tag":151,"props":2202,"children":2203},{"style":174},[2204],{"type":52,"value":1980},{"type":46,"tag":151,"props":2206,"children":2207},{"style":168},[2208],{"type":52,"value":1870},{"type":46,"tag":151,"props":2210,"children":2211},{"style":174},[2212],{"type":52,"value":380},{"type":46,"tag":151,"props":2214,"children":2215},{"style":168},[2216],{"type":52,"value":1889},{"type":46,"tag":151,"props":2218,"children":2219},{"style":174},[2220],{"type":52,"value":596},{"type":46,"tag":151,"props":2222,"children":2223},{"style":199},[2224],{"type":52,"value":301},{"type":46,"tag":151,"props":2226,"children":2227},{"class":153,"line":426},[2228,2232,2237,2241,2246],{"type":46,"tag":151,"props":2229,"children":2230},{"style":1356},[2231],{"type":52,"value":2174},{"type":46,"tag":151,"props":2233,"children":2234},{"style":1426},[2235],{"type":52,"value":2236}," Promise",{"type":46,"tag":151,"props":2238,"children":2239},{"style":174},[2240],{"type":52,"value":177},{"type":46,"tag":151,"props":2242,"children":2243},{"style":180},[2244],{"type":52,"value":2245},"all",{"type":46,"tag":151,"props":2247,"children":2248},{"style":199},[2249],{"type":52,"value":341},{"type":46,"tag":151,"props":2251,"children":2252},{"class":153,"line":503},[2253,2258,2262,2266,2270,2274,2278],{"type":46,"tag":151,"props":2254,"children":2255},{"style":168},[2256],{"type":52,"value":2257},"        projectCollection",{"type":46,"tag":151,"props":2259,"children":2260},{"style":174},[2261],{"type":52,"value":177},{"type":46,"tag":151,"props":2263,"children":2264},{"style":168},[2265],{"type":52,"value":1725},{"type":46,"tag":151,"props":2267,"children":2268},{"style":174},[2269],{"type":52,"value":177},{"type":46,"tag":151,"props":2271,"children":2272},{"style":180},[2273],{"type":52,"value":1734},{"type":46,"tag":151,"props":2275,"children":2276},{"style":199},[2277],{"type":52,"value":226},{"type":46,"tag":151,"props":2279,"children":2280},{"style":174},[2281],{"type":52,"value":231},{"type":46,"tag":151,"props":2283,"children":2284},{"class":153,"line":512},[2285,2290,2294,2298,2302,2306,2310],{"type":46,"tag":151,"props":2286,"children":2287},{"style":168},[2288],{"type":52,"value":2289},"        userCollection",{"type":46,"tag":151,"props":2291,"children":2292},{"style":174},[2293],{"type":52,"value":177},{"type":46,"tag":151,"props":2295,"children":2296},{"style":168},[2297],{"type":52,"value":1725},{"type":46,"tag":151,"props":2299,"children":2300},{"style":174},[2301],{"type":52,"value":177},{"type":46,"tag":151,"props":2303,"children":2304},{"style":180},[2305],{"type":52,"value":1734},{"type":46,"tag":151,"props":2307,"children":2308},{"style":199},[2309],{"type":52,"value":226},{"type":46,"tag":151,"props":2311,"children":2312},{"style":174},[2313],{"type":52,"value":231},{"type":46,"tag":151,"props":2315,"children":2316},{"class":153,"line":520},[2317],{"type":46,"tag":151,"props":2318,"children":2319},{"style":199},[2320],{"type":52,"value":2321},"      ])\n",{"type":46,"tag":151,"props":2323,"children":2324},{"class":153,"line":529},[2325],{"type":46,"tag":151,"props":2326,"children":2327},{"style":174},[2328],{"type":52,"value":2122},{"type":46,"tag":151,"props":2330,"children":2331},{"class":153,"line":607},[2332],{"type":46,"tag":151,"props":2333,"children":2334},{"style":174},[2335],{"type":52,"value":1139},{"type":46,"tag":151,"props":2337,"children":2338},{"class":153,"line":1023},[2339],{"type":46,"tag":151,"props":2340,"children":2341},{"style":168},[2342],{"type":52,"value":301},{"type":46,"tag":134,"props":2344,"children":2346},{"id":2345},"_2-createpacedmutations-auto-save-with-debounce-throttle-queue",[2347],{"type":52,"value":2348},"2. createPacedMutations -- auto-save with debounce \u002F throttle \u002F queue",{"type":46,"tag":140,"props":2350,"children":2352},{"className":142,"code":2351,"language":144,"meta":145,"style":145},"import { createPacedMutations, debounceStrategy } from '@tanstack\u002Fdb'\n\nconst autoSaveNote = createPacedMutations\u003Cstring>({\n  onMutate: (text) => {\n    noteCollection.update(noteId, (draft) => {\n      draft.body = text\n    })\n  },\n  mutationFn: async ({ transaction }) => {\n    const mutation = transaction.mutations[0]\n    await api.notes.update(mutation.key, mutation.changes)\n    await noteCollection.utils.refetch()\n  },\n  strategy: debounceStrategy({ wait: 500 }),\n})\n\n\u002F\u002F Each call resets the debounce timer; mutations merge into one transaction\nautoSaveNote('Hello')\nautoSaveNote('Hello, world') \u002F\u002F only this version persists\n",[2353],{"type":46,"tag":71,"props":2354,"children":2355},{"__ignoreMap":145},[2356,2401,2408,2448,2479,2528,2553,2564,2571,2606,2651,2718,2750,2757,2807,2818,2825,2833,2862],{"type":46,"tag":151,"props":2357,"children":2358},{"class":153,"line":154},[2359,2363,2367,2372,2376,2381,2385,2389,2393,2397],{"type":46,"tag":151,"props":2360,"children":2361},{"style":1356},[2362],{"type":52,"value":587},{"type":46,"tag":151,"props":2364,"children":2365},{"style":174},[2366],{"type":52,"value":556},{"type":46,"tag":151,"props":2368,"children":2369},{"style":168},[2370],{"type":52,"value":2371}," createPacedMutations",{"type":46,"tag":151,"props":2373,"children":2374},{"style":174},[2375],{"type":52,"value":380},{"type":46,"tag":151,"props":2377,"children":2378},{"style":168},[2379],{"type":52,"value":2380}," debounceStrategy",{"type":46,"tag":151,"props":2382,"children":2383},{"style":174},[2384],{"type":52,"value":596},{"type":46,"tag":151,"props":2386,"children":2387},{"style":1356},[2388],{"type":52,"value":1376},{"type":46,"tag":151,"props":2390,"children":2391},{"style":174},[2392],{"type":52,"value":249},{"type":46,"tag":151,"props":2394,"children":2395},{"style":252},[2396],{"type":52,"value":1385},{"type":46,"tag":151,"props":2398,"children":2399},{"style":174},[2400],{"type":52,"value":1130},{"type":46,"tag":151,"props":2402,"children":2403},{"class":153,"line":164},[2404],{"type":46,"tag":151,"props":2405,"children":2406},{"emptyLinePlaceholder":308},[2407],{"type":52,"value":311},{"type":46,"tag":151,"props":2409,"children":2410},{"class":153,"line":195},[2411,2415,2420,2424,2428,2432,2436,2440,2444],{"type":46,"tag":151,"props":2412,"children":2413},{"style":727},[2414],{"type":52,"value":1404},{"type":46,"tag":151,"props":2416,"children":2417},{"style":168},[2418],{"type":52,"value":2419}," autoSaveNote ",{"type":46,"tag":151,"props":2421,"children":2422},{"style":174},[2423],{"type":52,"value":1414},{"type":46,"tag":151,"props":2425,"children":2426},{"style":180},[2427],{"type":52,"value":2371},{"type":46,"tag":151,"props":2429,"children":2430},{"style":174},[2431],{"type":52,"value":1423},{"type":46,"tag":151,"props":2433,"children":2434},{"style":1426},[2435],{"type":52,"value":1429},{"type":46,"tag":151,"props":2437,"children":2438},{"style":174},[2439],{"type":52,"value":1434},{"type":46,"tag":151,"props":2441,"children":2442},{"style":168},[2443],{"type":52,"value":187},{"type":46,"tag":151,"props":2445,"children":2446},{"style":174},[2447],{"type":52,"value":192},{"type":46,"tag":151,"props":2449,"children":2450},{"class":153,"line":234},[2451,2455,2459,2463,2467,2471,2475],{"type":46,"tag":151,"props":2452,"children":2453},{"style":180},[2454],{"type":52,"value":1458},{"type":46,"tag":151,"props":2456,"children":2457},{"style":174},[2458],{"type":52,"value":207},{"type":46,"tag":151,"props":2460,"children":2461},{"style":174},[2462],{"type":52,"value":713},{"type":46,"tag":151,"props":2464,"children":2465},{"style":716},[2466],{"type":52,"value":52},{"type":46,"tag":151,"props":2468,"children":2469},{"style":174},[2470],{"type":52,"value":724},{"type":46,"tag":151,"props":2472,"children":2473},{"style":727},[2474],{"type":52,"value":730},{"type":46,"tag":151,"props":2476,"children":2477},{"style":174},[2478],{"type":52,"value":735},{"type":46,"tag":151,"props":2480,"children":2481},{"class":153,"line":267},[2482,2487,2491,2495,2499,2504,2508,2512,2516,2520,2524],{"type":46,"tag":151,"props":2483,"children":2484},{"style":168},[2485],{"type":52,"value":2486},"    noteCollection",{"type":46,"tag":151,"props":2488,"children":2489},{"style":174},[2490],{"type":52,"value":177},{"type":46,"tag":151,"props":2492,"children":2493},{"style":180},[2494],{"type":52,"value":690},{"type":46,"tag":151,"props":2496,"children":2497},{"style":199},[2498],{"type":52,"value":187},{"type":46,"tag":151,"props":2500,"children":2501},{"style":168},[2502],{"type":52,"value":2503},"noteId",{"type":46,"tag":151,"props":2505,"children":2506},{"style":174},[2507],{"type":52,"value":380},{"type":46,"tag":151,"props":2509,"children":2510},{"style":174},[2511],{"type":52,"value":713},{"type":46,"tag":151,"props":2513,"children":2514},{"style":716},[2515],{"type":52,"value":719},{"type":46,"tag":151,"props":2517,"children":2518},{"style":174},[2519],{"type":52,"value":724},{"type":46,"tag":151,"props":2521,"children":2522},{"style":727},[2523],{"type":52,"value":730},{"type":46,"tag":151,"props":2525,"children":2526},{"style":174},[2527],{"type":52,"value":735},{"type":46,"tag":151,"props":2529,"children":2530},{"class":153,"line":290},[2531,2535,2539,2544,2548],{"type":46,"tag":151,"props":2532,"children":2533},{"style":168},[2534],{"type":52,"value":1539},{"type":46,"tag":151,"props":2536,"children":2537},{"style":174},[2538],{"type":52,"value":177},{"type":46,"tag":151,"props":2540,"children":2541},{"style":168},[2542],{"type":52,"value":2543},"body",{"type":46,"tag":151,"props":2545,"children":2546},{"style":174},[2547],{"type":52,"value":757},{"type":46,"tag":151,"props":2549,"children":2550},{"style":168},[2551],{"type":52,"value":2552}," text\n",{"type":46,"tag":151,"props":2554,"children":2555},{"class":153,"line":304},[2556,2560],{"type":46,"tag":151,"props":2557,"children":2558},{"style":174},[2559],{"type":52,"value":1591},{"type":46,"tag":151,"props":2561,"children":2562},{"style":199},[2563],{"type":52,"value":301},{"type":46,"tag":151,"props":2565,"children":2566},{"class":153,"line":314},[2567],{"type":46,"tag":151,"props":2568,"children":2569},{"style":174},[2570],{"type":52,"value":1139},{"type":46,"tag":151,"props":2572,"children":2573},{"class":153,"line":323},[2574,2578,2582,2586,2590,2594,2598,2602],{"type":46,"tag":151,"props":2575,"children":2576},{"style":180},[2577],{"type":52,"value":1610},{"type":46,"tag":151,"props":2579,"children":2580},{"style":174},[2581],{"type":52,"value":207},{"type":46,"tag":151,"props":2583,"children":2584},{"style":727},[2585],{"type":52,"value":1619},{"type":46,"tag":151,"props":2587,"children":2588},{"style":174},[2589],{"type":52,"value":1931},{"type":46,"tag":151,"props":2591,"children":2592},{"style":716},[2593],{"type":52,"value":1640},{"type":46,"tag":151,"props":2595,"children":2596},{"style":174},[2597],{"type":52,"value":1645},{"type":46,"tag":151,"props":2599,"children":2600},{"style":727},[2601],{"type":52,"value":730},{"type":46,"tag":151,"props":2603,"children":2604},{"style":174},[2605],{"type":52,"value":735},{"type":46,"tag":151,"props":2607,"children":2608},{"class":153,"line":344},[2609,2614,2619,2623,2627,2631,2636,2641,2646],{"type":46,"tag":151,"props":2610,"children":2611},{"style":727},[2612],{"type":52,"value":2613},"    const",{"type":46,"tag":151,"props":2615,"children":2616},{"style":168},[2617],{"type":52,"value":2618}," mutation",{"type":46,"tag":151,"props":2620,"children":2621},{"style":174},[2622],{"type":52,"value":757},{"type":46,"tag":151,"props":2624,"children":2625},{"style":168},[2626],{"type":52,"value":1640},{"type":46,"tag":151,"props":2628,"children":2629},{"style":174},[2630],{"type":52,"value":177},{"type":46,"tag":151,"props":2632,"children":2633},{"style":168},[2634],{"type":52,"value":2635},"mutations",{"type":46,"tag":151,"props":2637,"children":2638},{"style":199},[2639],{"type":52,"value":2640},"[",{"type":46,"tag":151,"props":2642,"children":2643},{"style":1556},[2644],{"type":52,"value":2645},"0",{"type":46,"tag":151,"props":2647,"children":2648},{"style":199},[2649],{"type":52,"value":2650},"]\n",{"type":46,"tag":151,"props":2652,"children":2653},{"class":153,"line":426},[2654,2658,2662,2666,2671,2675,2679,2683,2688,2692,2697,2701,2705,2709,2714],{"type":46,"tag":151,"props":2655,"children":2656},{"style":1356},[2657],{"type":52,"value":1661},{"type":46,"tag":151,"props":2659,"children":2660},{"style":168},[2661],{"type":52,"value":1666},{"type":46,"tag":151,"props":2663,"children":2664},{"style":174},[2665],{"type":52,"value":177},{"type":46,"tag":151,"props":2667,"children":2668},{"style":168},[2669],{"type":52,"value":2670},"notes",{"type":46,"tag":151,"props":2672,"children":2673},{"style":174},[2674],{"type":52,"value":177},{"type":46,"tag":151,"props":2676,"children":2677},{"style":180},[2678],{"type":52,"value":690},{"type":46,"tag":151,"props":2680,"children":2681},{"style":199},[2682],{"type":52,"value":187},{"type":46,"tag":151,"props":2684,"children":2685},{"style":168},[2686],{"type":52,"value":2687},"mutation",{"type":46,"tag":151,"props":2689,"children":2690},{"style":174},[2691],{"type":52,"value":177},{"type":46,"tag":151,"props":2693,"children":2694},{"style":168},[2695],{"type":52,"value":2696},"key",{"type":46,"tag":151,"props":2698,"children":2699},{"style":174},[2700],{"type":52,"value":380},{"type":46,"tag":151,"props":2702,"children":2703},{"style":168},[2704],{"type":52,"value":2618},{"type":46,"tag":151,"props":2706,"children":2707},{"style":174},[2708],{"type":52,"value":177},{"type":46,"tag":151,"props":2710,"children":2711},{"style":168},[2712],{"type":52,"value":2713},"changes",{"type":46,"tag":151,"props":2715,"children":2716},{"style":199},[2717],{"type":52,"value":301},{"type":46,"tag":151,"props":2719,"children":2720},{"class":153,"line":503},[2721,2725,2730,2734,2738,2742,2746],{"type":46,"tag":151,"props":2722,"children":2723},{"style":1356},[2724],{"type":52,"value":1661},{"type":46,"tag":151,"props":2726,"children":2727},{"style":168},[2728],{"type":52,"value":2729}," noteCollection",{"type":46,"tag":151,"props":2731,"children":2732},{"style":174},[2733],{"type":52,"value":177},{"type":46,"tag":151,"props":2735,"children":2736},{"style":168},[2737],{"type":52,"value":1725},{"type":46,"tag":151,"props":2739,"children":2740},{"style":174},[2741],{"type":52,"value":177},{"type":46,"tag":151,"props":2743,"children":2744},{"style":180},[2745],{"type":52,"value":1734},{"type":46,"tag":151,"props":2747,"children":2748},{"style":199},[2749],{"type":52,"value":797},{"type":46,"tag":151,"props":2751,"children":2752},{"class":153,"line":512},[2753],{"type":46,"tag":151,"props":2754,"children":2755},{"style":174},[2756],{"type":52,"value":1139},{"type":46,"tag":151,"props":2758,"children":2759},{"class":153,"line":520},[2760,2765,2769,2773,2777,2781,2786,2790,2795,2799,2803],{"type":46,"tag":151,"props":2761,"children":2762},{"style":199},[2763],{"type":52,"value":2764},"  strategy",{"type":46,"tag":151,"props":2766,"children":2767},{"style":174},[2768],{"type":52,"value":207},{"type":46,"tag":151,"props":2770,"children":2771},{"style":180},[2772],{"type":52,"value":2380},{"type":46,"tag":151,"props":2774,"children":2775},{"style":168},[2776],{"type":52,"value":187},{"type":46,"tag":151,"props":2778,"children":2779},{"style":174},[2780],{"type":52,"value":1980},{"type":46,"tag":151,"props":2782,"children":2783},{"style":199},[2784],{"type":52,"value":2785}," wait",{"type":46,"tag":151,"props":2787,"children":2788},{"style":174},[2789],{"type":52,"value":207},{"type":46,"tag":151,"props":2791,"children":2792},{"style":1556},[2793],{"type":52,"value":2794}," 500",{"type":46,"tag":151,"props":2796,"children":2797},{"style":174},[2798],{"type":52,"value":596},{"type":46,"tag":151,"props":2800,"children":2801},{"style":168},[2802],{"type":52,"value":724},{"type":46,"tag":151,"props":2804,"children":2805},{"style":174},[2806],{"type":52,"value":231},{"type":46,"tag":151,"props":2808,"children":2809},{"class":153,"line":529},[2810,2814],{"type":46,"tag":151,"props":2811,"children":2812},{"style":174},[2813],{"type":52,"value":296},{"type":46,"tag":151,"props":2815,"children":2816},{"style":168},[2817],{"type":52,"value":301},{"type":46,"tag":151,"props":2819,"children":2820},{"class":153,"line":607},[2821],{"type":46,"tag":151,"props":2822,"children":2823},{"emptyLinePlaceholder":308},[2824],{"type":52,"value":311},{"type":46,"tag":151,"props":2826,"children":2827},{"class":153,"line":1023},[2828],{"type":46,"tag":151,"props":2829,"children":2830},{"style":158},[2831],{"type":52,"value":2832},"\u002F\u002F Each call resets the debounce timer; mutations merge into one transaction\n",{"type":46,"tag":151,"props":2834,"children":2835},{"class":153,"line":1073},[2836,2841,2845,2849,2854,2858],{"type":46,"tag":151,"props":2837,"children":2838},{"style":180},[2839],{"type":52,"value":2840},"autoSaveNote",{"type":46,"tag":151,"props":2842,"children":2843},{"style":168},[2844],{"type":52,"value":187},{"type":46,"tag":151,"props":2846,"children":2847},{"style":174},[2848],{"type":52,"value":260},{"type":46,"tag":151,"props":2850,"children":2851},{"style":252},[2852],{"type":52,"value":2853},"Hello",{"type":46,"tag":151,"props":2855,"children":2856},{"style":174},[2857],{"type":52,"value":260},{"type":46,"tag":151,"props":2859,"children":2860},{"style":168},[2861],{"type":52,"value":301},{"type":46,"tag":151,"props":2863,"children":2864},{"class":153,"line":1098},[2865,2869,2873,2877,2882,2886,2891],{"type":46,"tag":151,"props":2866,"children":2867},{"style":180},[2868],{"type":52,"value":2840},{"type":46,"tag":151,"props":2870,"children":2871},{"style":168},[2872],{"type":52,"value":187},{"type":46,"tag":151,"props":2874,"children":2875},{"style":174},[2876],{"type":52,"value":260},{"type":46,"tag":151,"props":2878,"children":2879},{"style":252},[2880],{"type":52,"value":2881},"Hello, world",{"type":46,"tag":151,"props":2883,"children":2884},{"style":174},[2885],{"type":52,"value":260},{"type":46,"tag":151,"props":2887,"children":2888},{"style":168},[2889],{"type":52,"value":2890},") ",{"type":46,"tag":151,"props":2892,"children":2893},{"style":158},[2894],{"type":52,"value":2895},"\u002F\u002F only this version persists\n",{"type":46,"tag":59,"props":2897,"children":2898},{},[2899],{"type":52,"value":2900},"Other strategies:",{"type":46,"tag":140,"props":2902,"children":2904},{"className":142,"code":2903,"language":144,"meta":145,"style":145},"import { throttleStrategy, queueStrategy } from '@tanstack\u002Fdb'\n\n\u002F\u002F Evenly spaced (sliders, scroll)\nthrottleStrategy({ wait: 200, leading: true, trailing: true })\n\n\u002F\u002F Sequential FIFO -- every mutation persisted in order\nqueueStrategy({ wait: 0, maxSize: 100 })\n",[2905],{"type":46,"tag":71,"props":2906,"children":2907},{"__ignoreMap":145},[2908,2953,2960,2968,3040,3047,3055],{"type":46,"tag":151,"props":2909,"children":2910},{"class":153,"line":154},[2911,2915,2919,2924,2928,2933,2937,2941,2945,2949],{"type":46,"tag":151,"props":2912,"children":2913},{"style":1356},[2914],{"type":52,"value":587},{"type":46,"tag":151,"props":2916,"children":2917},{"style":174},[2918],{"type":52,"value":556},{"type":46,"tag":151,"props":2920,"children":2921},{"style":168},[2922],{"type":52,"value":2923}," throttleStrategy",{"type":46,"tag":151,"props":2925,"children":2926},{"style":174},[2927],{"type":52,"value":380},{"type":46,"tag":151,"props":2929,"children":2930},{"style":168},[2931],{"type":52,"value":2932}," queueStrategy",{"type":46,"tag":151,"props":2934,"children":2935},{"style":174},[2936],{"type":52,"value":596},{"type":46,"tag":151,"props":2938,"children":2939},{"style":1356},[2940],{"type":52,"value":1376},{"type":46,"tag":151,"props":2942,"children":2943},{"style":174},[2944],{"type":52,"value":249},{"type":46,"tag":151,"props":2946,"children":2947},{"style":252},[2948],{"type":52,"value":1385},{"type":46,"tag":151,"props":2950,"children":2951},{"style":174},[2952],{"type":52,"value":1130},{"type":46,"tag":151,"props":2954,"children":2955},{"class":153,"line":164},[2956],{"type":46,"tag":151,"props":2957,"children":2958},{"emptyLinePlaceholder":308},[2959],{"type":52,"value":311},{"type":46,"tag":151,"props":2961,"children":2962},{"class":153,"line":195},[2963],{"type":46,"tag":151,"props":2964,"children":2965},{"style":158},[2966],{"type":52,"value":2967},"\u002F\u002F Evenly spaced (sliders, scroll)\n",{"type":46,"tag":151,"props":2969,"children":2970},{"class":153,"line":234},[2971,2976,2980,2984,2988,2992,2997,3001,3006,3010,3015,3019,3024,3028,3032,3036],{"type":46,"tag":151,"props":2972,"children":2973},{"style":180},[2974],{"type":52,"value":2975},"throttleStrategy",{"type":46,"tag":151,"props":2977,"children":2978},{"style":168},[2979],{"type":52,"value":187},{"type":46,"tag":151,"props":2981,"children":2982},{"style":174},[2983],{"type":52,"value":1980},{"type":46,"tag":151,"props":2985,"children":2986},{"style":199},[2987],{"type":52,"value":2785},{"type":46,"tag":151,"props":2989,"children":2990},{"style":174},[2991],{"type":52,"value":207},{"type":46,"tag":151,"props":2993,"children":2994},{"style":1556},[2995],{"type":52,"value":2996}," 200",{"type":46,"tag":151,"props":2998,"children":2999},{"style":174},[3000],{"type":52,"value":380},{"type":46,"tag":151,"props":3002,"children":3003},{"style":199},[3004],{"type":52,"value":3005}," leading",{"type":46,"tag":151,"props":3007,"children":3008},{"style":174},[3009],{"type":52,"value":207},{"type":46,"tag":151,"props":3011,"children":3012},{"style":280},[3013],{"type":52,"value":3014}," true",{"type":46,"tag":151,"props":3016,"children":3017},{"style":174},[3018],{"type":52,"value":380},{"type":46,"tag":151,"props":3020,"children":3021},{"style":199},[3022],{"type":52,"value":3023}," trailing",{"type":46,"tag":151,"props":3025,"children":3026},{"style":174},[3027],{"type":52,"value":207},{"type":46,"tag":151,"props":3029,"children":3030},{"style":280},[3031],{"type":52,"value":3014},{"type":46,"tag":151,"props":3033,"children":3034},{"style":174},[3035],{"type":52,"value":596},{"type":46,"tag":151,"props":3037,"children":3038},{"style":168},[3039],{"type":52,"value":301},{"type":46,"tag":151,"props":3041,"children":3042},{"class":153,"line":267},[3043],{"type":46,"tag":151,"props":3044,"children":3045},{"emptyLinePlaceholder":308},[3046],{"type":52,"value":311},{"type":46,"tag":151,"props":3048,"children":3049},{"class":153,"line":290},[3050],{"type":46,"tag":151,"props":3051,"children":3052},{"style":158},[3053],{"type":52,"value":3054},"\u002F\u002F Sequential FIFO -- every mutation persisted in order\n",{"type":46,"tag":151,"props":3056,"children":3057},{"class":153,"line":304},[3058,3063,3067,3071,3075,3079,3084,3088,3093,3097,3102,3106],{"type":46,"tag":151,"props":3059,"children":3060},{"style":180},[3061],{"type":52,"value":3062},"queueStrategy",{"type":46,"tag":151,"props":3064,"children":3065},{"style":168},[3066],{"type":52,"value":187},{"type":46,"tag":151,"props":3068,"children":3069},{"style":174},[3070],{"type":52,"value":1980},{"type":46,"tag":151,"props":3072,"children":3073},{"style":199},[3074],{"type":52,"value":2785},{"type":46,"tag":151,"props":3076,"children":3077},{"style":174},[3078],{"type":52,"value":207},{"type":46,"tag":151,"props":3080,"children":3081},{"style":1556},[3082],{"type":52,"value":3083}," 0",{"type":46,"tag":151,"props":3085,"children":3086},{"style":174},[3087],{"type":52,"value":380},{"type":46,"tag":151,"props":3089,"children":3090},{"style":199},[3091],{"type":52,"value":3092}," maxSize",{"type":46,"tag":151,"props":3094,"children":3095},{"style":174},[3096],{"type":52,"value":207},{"type":46,"tag":151,"props":3098,"children":3099},{"style":1556},[3100],{"type":52,"value":3101}," 100",{"type":46,"tag":151,"props":3103,"children":3104},{"style":174},[3105],{"type":52,"value":596},{"type":46,"tag":151,"props":3107,"children":3108},{"style":168},[3109],{"type":52,"value":301},{"type":46,"tag":134,"props":3111,"children":3113},{"id":3112},"_3-createtransaction-manual-batching",[3114],{"type":52,"value":3115},"3. createTransaction -- manual batching",{"type":46,"tag":140,"props":3117,"children":3119},{"className":142,"code":3118,"language":144,"meta":145,"style":145},"import { createTransaction } from '@tanstack\u002Fdb'\n\nconst tx = createTransaction({\n  autoCommit: false, \u002F\u002F wait for explicit commit()\n  mutationFn: async ({ transaction }) => {\n    await api.batchUpdate(transaction.mutations)\n  },\n})\n\ntx.mutate(() => {\n  todoCollection.update(id1, (d) => {\n    d.status = 'reviewed'\n  })\n  todoCollection.update(id2, (d) => {\n    d.status = 'reviewed'\n  })\n})\n\n\u002F\u002F User reviews... then commits or rolls back\nawait tx.commit()\n\u002F\u002F OR: tx.rollback()\n",[3120],{"type":46,"tag":71,"props":3121,"children":3122},{"__ignoreMap":145},[3123,3159,3166,3193,3218,3253,3294,3301,3312,3319,3352,3401,3434,3445,3493,3524,3535,3546,3553,3561,3585],{"type":46,"tag":151,"props":3124,"children":3125},{"class":153,"line":154},[3126,3130,3134,3139,3143,3147,3151,3155],{"type":46,"tag":151,"props":3127,"children":3128},{"style":1356},[3129],{"type":52,"value":587},{"type":46,"tag":151,"props":3131,"children":3132},{"style":174},[3133],{"type":52,"value":556},{"type":46,"tag":151,"props":3135,"children":3136},{"style":168},[3137],{"type":52,"value":3138}," createTransaction",{"type":46,"tag":151,"props":3140,"children":3141},{"style":174},[3142],{"type":52,"value":596},{"type":46,"tag":151,"props":3144,"children":3145},{"style":1356},[3146],{"type":52,"value":1376},{"type":46,"tag":151,"props":3148,"children":3149},{"style":174},[3150],{"type":52,"value":249},{"type":46,"tag":151,"props":3152,"children":3153},{"style":252},[3154],{"type":52,"value":1385},{"type":46,"tag":151,"props":3156,"children":3157},{"style":174},[3158],{"type":52,"value":1130},{"type":46,"tag":151,"props":3160,"children":3161},{"class":153,"line":164},[3162],{"type":46,"tag":151,"props":3163,"children":3164},{"emptyLinePlaceholder":308},[3165],{"type":52,"value":311},{"type":46,"tag":151,"props":3167,"children":3168},{"class":153,"line":195},[3169,3173,3177,3181,3185,3189],{"type":46,"tag":151,"props":3170,"children":3171},{"style":727},[3172],{"type":52,"value":1404},{"type":46,"tag":151,"props":3174,"children":3175},{"style":168},[3176],{"type":52,"value":1783},{"type":46,"tag":151,"props":3178,"children":3179},{"style":174},[3180],{"type":52,"value":1414},{"type":46,"tag":151,"props":3182,"children":3183},{"style":180},[3184],{"type":52,"value":3138},{"type":46,"tag":151,"props":3186,"children":3187},{"style":168},[3188],{"type":52,"value":187},{"type":46,"tag":151,"props":3190,"children":3191},{"style":174},[3192],{"type":52,"value":192},{"type":46,"tag":151,"props":3194,"children":3195},{"class":153,"line":234},[3196,3201,3205,3209,3213],{"type":46,"tag":151,"props":3197,"children":3198},{"style":199},[3199],{"type":52,"value":3200},"  autoCommit",{"type":46,"tag":151,"props":3202,"children":3203},{"style":174},[3204],{"type":52,"value":207},{"type":46,"tag":151,"props":3206,"children":3207},{"style":280},[3208],{"type":52,"value":283},{"type":46,"tag":151,"props":3210,"children":3211},{"style":174},[3212],{"type":52,"value":380},{"type":46,"tag":151,"props":3214,"children":3215},{"style":158},[3216],{"type":52,"value":3217}," \u002F\u002F wait for explicit commit()\n",{"type":46,"tag":151,"props":3219,"children":3220},{"class":153,"line":267},[3221,3225,3229,3233,3237,3241,3245,3249],{"type":46,"tag":151,"props":3222,"children":3223},{"style":180},[3224],{"type":52,"value":1610},{"type":46,"tag":151,"props":3226,"children":3227},{"style":174},[3228],{"type":52,"value":207},{"type":46,"tag":151,"props":3230,"children":3231},{"style":727},[3232],{"type":52,"value":1619},{"type":46,"tag":151,"props":3234,"children":3235},{"style":174},[3236],{"type":52,"value":1931},{"type":46,"tag":151,"props":3238,"children":3239},{"style":716},[3240],{"type":52,"value":1640},{"type":46,"tag":151,"props":3242,"children":3243},{"style":174},[3244],{"type":52,"value":1645},{"type":46,"tag":151,"props":3246,"children":3247},{"style":727},[3248],{"type":52,"value":730},{"type":46,"tag":151,"props":3250,"children":3251},{"style":174},[3252],{"type":52,"value":735},{"type":46,"tag":151,"props":3254,"children":3255},{"class":153,"line":290},[3256,3260,3264,3268,3273,3277,3282,3286,3290],{"type":46,"tag":151,"props":3257,"children":3258},{"style":1356},[3259],{"type":52,"value":1661},{"type":46,"tag":151,"props":3261,"children":3262},{"style":168},[3263],{"type":52,"value":1666},{"type":46,"tag":151,"props":3265,"children":3266},{"style":174},[3267],{"type":52,"value":177},{"type":46,"tag":151,"props":3269,"children":3270},{"style":180},[3271],{"type":52,"value":3272},"batchUpdate",{"type":46,"tag":151,"props":3274,"children":3275},{"style":199},[3276],{"type":52,"value":187},{"type":46,"tag":151,"props":3278,"children":3279},{"style":168},[3280],{"type":52,"value":3281},"transaction",{"type":46,"tag":151,"props":3283,"children":3284},{"style":174},[3285],{"type":52,"value":177},{"type":46,"tag":151,"props":3287,"children":3288},{"style":168},[3289],{"type":52,"value":2635},{"type":46,"tag":151,"props":3291,"children":3292},{"style":199},[3293],{"type":52,"value":301},{"type":46,"tag":151,"props":3295,"children":3296},{"class":153,"line":304},[3297],{"type":46,"tag":151,"props":3298,"children":3299},{"style":174},[3300],{"type":52,"value":1139},{"type":46,"tag":151,"props":3302,"children":3303},{"class":153,"line":314},[3304,3308],{"type":46,"tag":151,"props":3305,"children":3306},{"style":174},[3307],{"type":52,"value":296},{"type":46,"tag":151,"props":3309,"children":3310},{"style":168},[3311],{"type":52,"value":301},{"type":46,"tag":151,"props":3313,"children":3314},{"class":153,"line":323},[3315],{"type":46,"tag":151,"props":3316,"children":3317},{"emptyLinePlaceholder":308},[3318],{"type":52,"value":311},{"type":46,"tag":151,"props":3320,"children":3321},{"class":153,"line":344},[3322,3327,3331,3336,3340,3344,3348],{"type":46,"tag":151,"props":3323,"children":3324},{"style":168},[3325],{"type":52,"value":3326},"tx",{"type":46,"tag":151,"props":3328,"children":3329},{"style":174},[3330],{"type":52,"value":177},{"type":46,"tag":151,"props":3332,"children":3333},{"style":180},[3334],{"type":52,"value":3335},"mutate",{"type":46,"tag":151,"props":3337,"children":3338},{"style":168},[3339],{"type":52,"value":187},{"type":46,"tag":151,"props":3341,"children":3342},{"style":174},[3343],{"type":52,"value":226},{"type":46,"tag":151,"props":3345,"children":3346},{"style":727},[3347],{"type":52,"value":730},{"type":46,"tag":151,"props":3349,"children":3350},{"style":174},[3351],{"type":52,"value":735},{"type":46,"tag":151,"props":3353,"children":3354},{"class":153,"line":426},[3355,3360,3364,3368,3372,3377,3381,3385,3389,3393,3397],{"type":46,"tag":151,"props":3356,"children":3357},{"style":168},[3358],{"type":52,"value":3359},"  todoCollection",{"type":46,"tag":151,"props":3361,"children":3362},{"style":174},[3363],{"type":52,"value":177},{"type":46,"tag":151,"props":3365,"children":3366},{"style":180},[3367],{"type":52,"value":690},{"type":46,"tag":151,"props":3369,"children":3370},{"style":199},[3371],{"type":52,"value":187},{"type":46,"tag":151,"props":3373,"children":3374},{"style":168},[3375],{"type":52,"value":3376},"id1",{"type":46,"tag":151,"props":3378,"children":3379},{"style":174},[3380],{"type":52,"value":380},{"type":46,"tag":151,"props":3382,"children":3383},{"style":174},[3384],{"type":52,"value":713},{"type":46,"tag":151,"props":3386,"children":3387},{"style":716},[3388],{"type":52,"value":906},{"type":46,"tag":151,"props":3390,"children":3391},{"style":174},[3392],{"type":52,"value":724},{"type":46,"tag":151,"props":3394,"children":3395},{"style":727},[3396],{"type":52,"value":730},{"type":46,"tag":151,"props":3398,"children":3399},{"style":174},[3400],{"type":52,"value":735},{"type":46,"tag":151,"props":3402,"children":3403},{"class":153,"line":503},[3404,3408,3412,3417,3421,3425,3430],{"type":46,"tag":151,"props":3405,"children":3406},{"style":168},[3407],{"type":52,"value":926},{"type":46,"tag":151,"props":3409,"children":3410},{"style":174},[3411],{"type":52,"value":177},{"type":46,"tag":151,"props":3413,"children":3414},{"style":168},[3415],{"type":52,"value":3416},"status",{"type":46,"tag":151,"props":3418,"children":3419},{"style":174},[3420],{"type":52,"value":757},{"type":46,"tag":151,"props":3422,"children":3423},{"style":174},[3424],{"type":52,"value":249},{"type":46,"tag":151,"props":3426,"children":3427},{"style":252},[3428],{"type":52,"value":3429},"reviewed",{"type":46,"tag":151,"props":3431,"children":3432},{"style":174},[3433],{"type":52,"value":1130},{"type":46,"tag":151,"props":3435,"children":3436},{"class":153,"line":512},[3437,3441],{"type":46,"tag":151,"props":3438,"children":3439},{"style":174},[3440],{"type":52,"value":950},{"type":46,"tag":151,"props":3442,"children":3443},{"style":199},[3444],{"type":52,"value":301},{"type":46,"tag":151,"props":3446,"children":3447},{"class":153,"line":520},[3448,3452,3456,3460,3464,3469,3473,3477,3481,3485,3489],{"type":46,"tag":151,"props":3449,"children":3450},{"style":168},[3451],{"type":52,"value":3359},{"type":46,"tag":151,"props":3453,"children":3454},{"style":174},[3455],{"type":52,"value":177},{"type":46,"tag":151,"props":3457,"children":3458},{"style":180},[3459],{"type":52,"value":690},{"type":46,"tag":151,"props":3461,"children":3462},{"style":199},[3463],{"type":52,"value":187},{"type":46,"tag":151,"props":3465,"children":3466},{"style":168},[3467],{"type":52,"value":3468},"id2",{"type":46,"tag":151,"props":3470,"children":3471},{"style":174},[3472],{"type":52,"value":380},{"type":46,"tag":151,"props":3474,"children":3475},{"style":174},[3476],{"type":52,"value":713},{"type":46,"tag":151,"props":3478,"children":3479},{"style":716},[3480],{"type":52,"value":906},{"type":46,"tag":151,"props":3482,"children":3483},{"style":174},[3484],{"type":52,"value":724},{"type":46,"tag":151,"props":3486,"children":3487},{"style":727},[3488],{"type":52,"value":730},{"type":46,"tag":151,"props":3490,"children":3491},{"style":174},[3492],{"type":52,"value":735},{"type":46,"tag":151,"props":3494,"children":3495},{"class":153,"line":529},[3496,3500,3504,3508,3512,3516,3520],{"type":46,"tag":151,"props":3497,"children":3498},{"style":168},[3499],{"type":52,"value":926},{"type":46,"tag":151,"props":3501,"children":3502},{"style":174},[3503],{"type":52,"value":177},{"type":46,"tag":151,"props":3505,"children":3506},{"style":168},[3507],{"type":52,"value":3416},{"type":46,"tag":151,"props":3509,"children":3510},{"style":174},[3511],{"type":52,"value":757},{"type":46,"tag":151,"props":3513,"children":3514},{"style":174},[3515],{"type":52,"value":249},{"type":46,"tag":151,"props":3517,"children":3518},{"style":252},[3519],{"type":52,"value":3429},{"type":46,"tag":151,"props":3521,"children":3522},{"style":174},[3523],{"type":52,"value":1130},{"type":46,"tag":151,"props":3525,"children":3526},{"class":153,"line":607},[3527,3531],{"type":46,"tag":151,"props":3528,"children":3529},{"style":174},[3530],{"type":52,"value":950},{"type":46,"tag":151,"props":3532,"children":3533},{"style":199},[3534],{"type":52,"value":301},{"type":46,"tag":151,"props":3536,"children":3537},{"class":153,"line":1023},[3538,3542],{"type":46,"tag":151,"props":3539,"children":3540},{"style":174},[3541],{"type":52,"value":296},{"type":46,"tag":151,"props":3543,"children":3544},{"style":168},[3545],{"type":52,"value":301},{"type":46,"tag":151,"props":3547,"children":3548},{"class":153,"line":1073},[3549],{"type":46,"tag":151,"props":3550,"children":3551},{"emptyLinePlaceholder":308},[3552],{"type":52,"value":311},{"type":46,"tag":151,"props":3554,"children":3555},{"class":153,"line":1098},[3556],{"type":46,"tag":151,"props":3557,"children":3558},{"style":158},[3559],{"type":52,"value":3560},"\u002F\u002F User reviews... then commits or rolls back\n",{"type":46,"tag":151,"props":3562,"children":3563},{"class":153,"line":1133},[3564,3568,3572,3576,3581],{"type":46,"tag":151,"props":3565,"children":3566},{"style":1356},[3567],{"type":52,"value":1805},{"type":46,"tag":151,"props":3569,"children":3570},{"style":168},[3571],{"type":52,"value":1810},{"type":46,"tag":151,"props":3573,"children":3574},{"style":174},[3575],{"type":52,"value":177},{"type":46,"tag":151,"props":3577,"children":3578},{"style":180},[3579],{"type":52,"value":3580},"commit",{"type":46,"tag":151,"props":3582,"children":3583},{"style":168},[3584],{"type":52,"value":797},{"type":46,"tag":151,"props":3586,"children":3587},{"class":153,"line":1142},[3588],{"type":46,"tag":151,"props":3589,"children":3590},{"style":158},[3591],{"type":52,"value":3592},"\u002F\u002F OR: tx.rollback()\n",{"type":46,"tag":59,"props":3594,"children":3595},{},[3596,3598,3604,3606,3612,3614,3620],{"type":52,"value":3597},"Inside ",{"type":46,"tag":71,"props":3599,"children":3601},{"className":3600},[],[3602],{"type":52,"value":3603},"tx.mutate(() => { ... })",{"type":52,"value":3605},", the transaction is pushed onto an ambient\nstack. Any ",{"type":46,"tag":71,"props":3607,"children":3609},{"className":3608},[],[3610],{"type":52,"value":3611},"collection.insert\u002Fupdate\u002Fdelete",{"type":52,"value":3613}," call joins the ambient transaction\nautomatically via ",{"type":46,"tag":71,"props":3615,"children":3617},{"className":3616},[],[3618],{"type":52,"value":3619},"getActiveTransaction()",{"type":52,"value":177},{"type":46,"tag":59,"props":3622,"children":3623},{},[3624,3626,3631,3632,3637,3638,3643,3645,3651,3653,3659,3661,3667,3669,3675],{"type":52,"value":3625},"For mutations captured by a manual transaction, collection-level\n",{"type":46,"tag":71,"props":3627,"children":3629},{"className":3628},[],[3630],{"type":52,"value":92},{"type":52,"value":94},{"type":46,"tag":71,"props":3633,"children":3635},{"className":3634},[],[3636],{"type":52,"value":100},{"type":52,"value":94},{"type":46,"tag":71,"props":3639,"children":3641},{"className":3640},[],[3642],{"type":52,"value":107},{"type":52,"value":3644}," handlers are not invoked automatically. The\nmanual transaction's ",{"type":46,"tag":71,"props":3646,"children":3648},{"className":3647},[],[3649],{"type":52,"value":3650},"mutationFn",{"type":52,"value":3652}," is responsible for persisting\n",{"type":46,"tag":71,"props":3654,"children":3656},{"className":3655},[],[3657],{"type":52,"value":3658},"transaction.mutations",{"type":52,"value":3660},". This makes ",{"type":46,"tag":71,"props":3662,"children":3664},{"className":3663},[],[3665],{"type":52,"value":3666},"createTransaction({ autoCommit: false })",{"type":52,"value":3668},"\na good fit for draft-style flows where local state updates immediately but the\nserver call waits for Save\u002FBlur; call ",{"type":46,"tag":71,"props":3670,"children":3672},{"className":3671},[],[3673],{"type":52,"value":3674},"tx.rollback()",{"type":52,"value":3676}," to discard the optimistic\nchanges.",{"type":46,"tag":134,"props":3678,"children":3680},{"id":3679},"_4-mutation-handlers-with-automatic-refetch-querycollection-pattern",[3681],{"type":52,"value":3682},"4. Mutation handlers with automatic refetch (QueryCollection pattern)",{"type":46,"tag":140,"props":3684,"children":3686},{"className":142,"code":3685,"language":144,"meta":145,"style":145},"const todoCollection = createCollection(\n  queryCollectionOptions({\n    queryKey: ['todos'],\n    queryFn: () => api.todos.getAll(),\n    getKey: (t) => t.id,\n    onInsert: async ({ transaction }) => {\n      await Promise.all(\n        transaction.mutations.map((m) => api.todos.create(m.modified)),\n      )\n      \u002F\u002F Query Collection refetches after the handler completes and awaits it.\n    },\n    onUpdate: async ({ transaction }) => {\n      await Promise.all(\n        transaction.mutations.map((m) =>\n          api.todos.update(m.original.id, m.changes),\n        ),\n      )\n    },\n    onDelete: async ({ transaction }) => {\n      await Promise.all(\n        transaction.mutations.map((m) => api.todos.delete(m.original.id)),\n      )\n    },\n  }),\n)\n",[3687],{"type":46,"tag":71,"props":3688,"children":3689},{"__ignoreMap":145},[3690,3715,3731,3770,3820,3866,3902,3925,4017,4025,4033,4040,4076,4099,4143,4217,4229,4236,4243,4279,4302,4397,4405,4413,4429],{"type":46,"tag":151,"props":3691,"children":3692},{"class":153,"line":154},[3693,3697,3702,3706,3711],{"type":46,"tag":151,"props":3694,"children":3695},{"style":727},[3696],{"type":52,"value":1404},{"type":46,"tag":151,"props":3698,"children":3699},{"style":168},[3700],{"type":52,"value":3701}," todoCollection ",{"type":46,"tag":151,"props":3703,"children":3704},{"style":174},[3705],{"type":52,"value":1414},{"type":46,"tag":151,"props":3707,"children":3708},{"style":180},[3709],{"type":52,"value":3710}," createCollection",{"type":46,"tag":151,"props":3712,"children":3713},{"style":168},[3714],{"type":52,"value":1000},{"type":46,"tag":151,"props":3716,"children":3717},{"class":153,"line":164},[3718,3723,3727],{"type":46,"tag":151,"props":3719,"children":3720},{"style":180},[3721],{"type":52,"value":3722},"  queryCollectionOptions",{"type":46,"tag":151,"props":3724,"children":3725},{"style":168},[3726],{"type":52,"value":187},{"type":46,"tag":151,"props":3728,"children":3729},{"style":174},[3730],{"type":52,"value":192},{"type":46,"tag":151,"props":3732,"children":3733},{"class":153,"line":195},[3734,3739,3743,3748,3752,3757,3761,3766],{"type":46,"tag":151,"props":3735,"children":3736},{"style":199},[3737],{"type":52,"value":3738},"    queryKey",{"type":46,"tag":151,"props":3740,"children":3741},{"style":174},[3742],{"type":52,"value":207},{"type":46,"tag":151,"props":3744,"children":3745},{"style":168},[3746],{"type":52,"value":3747}," [",{"type":46,"tag":151,"props":3749,"children":3750},{"style":174},[3751],{"type":52,"value":260},{"type":46,"tag":151,"props":3753,"children":3754},{"style":252},[3755],{"type":52,"value":3756},"todos",{"type":46,"tag":151,"props":3758,"children":3759},{"style":174},[3760],{"type":52,"value":260},{"type":46,"tag":151,"props":3762,"children":3763},{"style":168},[3764],{"type":52,"value":3765},"]",{"type":46,"tag":151,"props":3767,"children":3768},{"style":174},[3769],{"type":52,"value":231},{"type":46,"tag":151,"props":3771,"children":3772},{"class":153,"line":234},[3773,3778,3782,3787,3791,3795,3799,3803,3807,3812,3816],{"type":46,"tag":151,"props":3774,"children":3775},{"style":180},[3776],{"type":52,"value":3777},"    queryFn",{"type":46,"tag":151,"props":3779,"children":3780},{"style":174},[3781],{"type":52,"value":207},{"type":46,"tag":151,"props":3783,"children":3784},{"style":174},[3785],{"type":52,"value":3786}," ()",{"type":46,"tag":151,"props":3788,"children":3789},{"style":727},[3790],{"type":52,"value":730},{"type":46,"tag":151,"props":3792,"children":3793},{"style":168},[3794],{"type":52,"value":1666},{"type":46,"tag":151,"props":3796,"children":3797},{"style":174},[3798],{"type":52,"value":177},{"type":46,"tag":151,"props":3800,"children":3801},{"style":168},[3802],{"type":52,"value":3756},{"type":46,"tag":151,"props":3804,"children":3805},{"style":174},[3806],{"type":52,"value":177},{"type":46,"tag":151,"props":3808,"children":3809},{"style":180},[3810],{"type":52,"value":3811},"getAll",{"type":46,"tag":151,"props":3813,"children":3814},{"style":168},[3815],{"type":52,"value":226},{"type":46,"tag":151,"props":3817,"children":3818},{"style":174},[3819],{"type":52,"value":231},{"type":46,"tag":151,"props":3821,"children":3822},{"class":153,"line":267},[3823,3828,3832,3836,3841,3845,3849,3854,3858,3862],{"type":46,"tag":151,"props":3824,"children":3825},{"style":180},[3826],{"type":52,"value":3827},"    getKey",{"type":46,"tag":151,"props":3829,"children":3830},{"style":174},[3831],{"type":52,"value":207},{"type":46,"tag":151,"props":3833,"children":3834},{"style":174},[3835],{"type":52,"value":713},{"type":46,"tag":151,"props":3837,"children":3838},{"style":716},[3839],{"type":52,"value":3840},"t",{"type":46,"tag":151,"props":3842,"children":3843},{"style":174},[3844],{"type":52,"value":724},{"type":46,"tag":151,"props":3846,"children":3847},{"style":727},[3848],{"type":52,"value":730},{"type":46,"tag":151,"props":3850,"children":3851},{"style":168},[3852],{"type":52,"value":3853}," t",{"type":46,"tag":151,"props":3855,"children":3856},{"style":174},[3857],{"type":52,"value":177},{"type":46,"tag":151,"props":3859,"children":3860},{"style":168},[3861],{"type":52,"value":704},{"type":46,"tag":151,"props":3863,"children":3864},{"style":174},[3865],{"type":52,"value":231},{"type":46,"tag":151,"props":3867,"children":3868},{"class":153,"line":290},[3869,3874,3878,3882,3886,3890,3894,3898],{"type":46,"tag":151,"props":3870,"children":3871},{"style":180},[3872],{"type":52,"value":3873},"    onInsert",{"type":46,"tag":151,"props":3875,"children":3876},{"style":174},[3877],{"type":52,"value":207},{"type":46,"tag":151,"props":3879,"children":3880},{"style":727},[3881],{"type":52,"value":1619},{"type":46,"tag":151,"props":3883,"children":3884},{"style":174},[3885],{"type":52,"value":1931},{"type":46,"tag":151,"props":3887,"children":3888},{"style":716},[3889],{"type":52,"value":1640},{"type":46,"tag":151,"props":3891,"children":3892},{"style":174},[3893],{"type":52,"value":1645},{"type":46,"tag":151,"props":3895,"children":3896},{"style":727},[3897],{"type":52,"value":730},{"type":46,"tag":151,"props":3899,"children":3900},{"style":174},[3901],{"type":52,"value":735},{"type":46,"tag":151,"props":3903,"children":3904},{"class":153,"line":304},[3905,3909,3913,3917,3921],{"type":46,"tag":151,"props":3906,"children":3907},{"style":1356},[3908],{"type":52,"value":2174},{"type":46,"tag":151,"props":3910,"children":3911},{"style":1426},[3912],{"type":52,"value":2236},{"type":46,"tag":151,"props":3914,"children":3915},{"style":174},[3916],{"type":52,"value":177},{"type":46,"tag":151,"props":3918,"children":3919},{"style":180},[3920],{"type":52,"value":2245},{"type":46,"tag":151,"props":3922,"children":3923},{"style":199},[3924],{"type":52,"value":1000},{"type":46,"tag":151,"props":3926,"children":3927},{"class":153,"line":314},[3928,3933,3937,3941,3945,3950,3954,3958,3963,3967,3971,3975,3979,3983,3987,3991,3995,3999,4003,4008,4013],{"type":46,"tag":151,"props":3929,"children":3930},{"style":168},[3931],{"type":52,"value":3932},"        transaction",{"type":46,"tag":151,"props":3934,"children":3935},{"style":174},[3936],{"type":52,"value":177},{"type":46,"tag":151,"props":3938,"children":3939},{"style":168},[3940],{"type":52,"value":2635},{"type":46,"tag":151,"props":3942,"children":3943},{"style":174},[3944],{"type":52,"value":177},{"type":46,"tag":151,"props":3946,"children":3947},{"style":180},[3948],{"type":52,"value":3949},"map",{"type":46,"tag":151,"props":3951,"children":3952},{"style":199},[3953],{"type":52,"value":187},{"type":46,"tag":151,"props":3955,"children":3956},{"style":174},[3957],{"type":52,"value":187},{"type":46,"tag":151,"props":3959,"children":3960},{"style":716},[3961],{"type":52,"value":3962},"m",{"type":46,"tag":151,"props":3964,"children":3965},{"style":174},[3966],{"type":52,"value":724},{"type":46,"tag":151,"props":3968,"children":3969},{"style":727},[3970],{"type":52,"value":730},{"type":46,"tag":151,"props":3972,"children":3973},{"style":168},[3974],{"type":52,"value":1666},{"type":46,"tag":151,"props":3976,"children":3977},{"style":174},[3978],{"type":52,"value":177},{"type":46,"tag":151,"props":3980,"children":3981},{"style":168},[3982],{"type":52,"value":3756},{"type":46,"tag":151,"props":3984,"children":3985},{"style":174},[3986],{"type":52,"value":177},{"type":46,"tag":151,"props":3988,"children":3989},{"style":180},[3990],{"type":52,"value":2196},{"type":46,"tag":151,"props":3992,"children":3993},{"style":199},[3994],{"type":52,"value":187},{"type":46,"tag":151,"props":3996,"children":3997},{"style":168},[3998],{"type":52,"value":3962},{"type":46,"tag":151,"props":4000,"children":4001},{"style":174},[4002],{"type":52,"value":177},{"type":46,"tag":151,"props":4004,"children":4005},{"style":168},[4006],{"type":52,"value":4007},"modified",{"type":46,"tag":151,"props":4009,"children":4010},{"style":199},[4011],{"type":52,"value":4012},"))",{"type":46,"tag":151,"props":4014,"children":4015},{"style":174},[4016],{"type":52,"value":231},{"type":46,"tag":151,"props":4018,"children":4019},{"class":153,"line":323},[4020],{"type":46,"tag":151,"props":4021,"children":4022},{"style":199},[4023],{"type":52,"value":4024},"      )\n",{"type":46,"tag":151,"props":4026,"children":4027},{"class":153,"line":344},[4028],{"type":46,"tag":151,"props":4029,"children":4030},{"style":158},[4031],{"type":52,"value":4032},"      \u002F\u002F Query Collection refetches after the handler completes and awaits it.\n",{"type":46,"tag":151,"props":4034,"children":4035},{"class":153,"line":426},[4036],{"type":46,"tag":151,"props":4037,"children":4038},{"style":174},[4039],{"type":52,"value":2122},{"type":46,"tag":151,"props":4041,"children":4042},{"class":153,"line":503},[4043,4048,4052,4056,4060,4064,4068,4072],{"type":46,"tag":151,"props":4044,"children":4045},{"style":180},[4046],{"type":52,"value":4047},"    onUpdate",{"type":46,"tag":151,"props":4049,"children":4050},{"style":174},[4051],{"type":52,"value":207},{"type":46,"tag":151,"props":4053,"children":4054},{"style":727},[4055],{"type":52,"value":1619},{"type":46,"tag":151,"props":4057,"children":4058},{"style":174},[4059],{"type":52,"value":1931},{"type":46,"tag":151,"props":4061,"children":4062},{"style":716},[4063],{"type":52,"value":1640},{"type":46,"tag":151,"props":4065,"children":4066},{"style":174},[4067],{"type":52,"value":1645},{"type":46,"tag":151,"props":4069,"children":4070},{"style":727},[4071],{"type":52,"value":730},{"type":46,"tag":151,"props":4073,"children":4074},{"style":174},[4075],{"type":52,"value":735},{"type":46,"tag":151,"props":4077,"children":4078},{"class":153,"line":512},[4079,4083,4087,4091,4095],{"type":46,"tag":151,"props":4080,"children":4081},{"style":1356},[4082],{"type":52,"value":2174},{"type":46,"tag":151,"props":4084,"children":4085},{"style":1426},[4086],{"type":52,"value":2236},{"type":46,"tag":151,"props":4088,"children":4089},{"style":174},[4090],{"type":52,"value":177},{"type":46,"tag":151,"props":4092,"children":4093},{"style":180},[4094],{"type":52,"value":2245},{"type":46,"tag":151,"props":4096,"children":4097},{"style":199},[4098],{"type":52,"value":1000},{"type":46,"tag":151,"props":4100,"children":4101},{"class":153,"line":520},[4102,4106,4110,4114,4118,4122,4126,4130,4134,4138],{"type":46,"tag":151,"props":4103,"children":4104},{"style":168},[4105],{"type":52,"value":3932},{"type":46,"tag":151,"props":4107,"children":4108},{"style":174},[4109],{"type":52,"value":177},{"type":46,"tag":151,"props":4111,"children":4112},{"style":168},[4113],{"type":52,"value":2635},{"type":46,"tag":151,"props":4115,"children":4116},{"style":174},[4117],{"type":52,"value":177},{"type":46,"tag":151,"props":4119,"children":4120},{"style":180},[4121],{"type":52,"value":3949},{"type":46,"tag":151,"props":4123,"children":4124},{"style":199},[4125],{"type":52,"value":187},{"type":46,"tag":151,"props":4127,"children":4128},{"style":174},[4129],{"type":52,"value":187},{"type":46,"tag":151,"props":4131,"children":4132},{"style":716},[4133],{"type":52,"value":3962},{"type":46,"tag":151,"props":4135,"children":4136},{"style":174},[4137],{"type":52,"value":724},{"type":46,"tag":151,"props":4139,"children":4140},{"style":727},[4141],{"type":52,"value":4142}," =>\n",{"type":46,"tag":151,"props":4144,"children":4145},{"class":153,"line":529},[4146,4151,4155,4159,4163,4167,4171,4175,4179,4184,4188,4192,4196,4201,4205,4209,4213],{"type":46,"tag":151,"props":4147,"children":4148},{"style":168},[4149],{"type":52,"value":4150},"          api",{"type":46,"tag":151,"props":4152,"children":4153},{"style":174},[4154],{"type":52,"value":177},{"type":46,"tag":151,"props":4156,"children":4157},{"style":168},[4158],{"type":52,"value":3756},{"type":46,"tag":151,"props":4160,"children":4161},{"style":174},[4162],{"type":52,"value":177},{"type":46,"tag":151,"props":4164,"children":4165},{"style":180},[4166],{"type":52,"value":690},{"type":46,"tag":151,"props":4168,"children":4169},{"style":199},[4170],{"type":52,"value":187},{"type":46,"tag":151,"props":4172,"children":4173},{"style":168},[4174],{"type":52,"value":3962},{"type":46,"tag":151,"props":4176,"children":4177},{"style":174},[4178],{"type":52,"value":177},{"type":46,"tag":151,"props":4180,"children":4181},{"style":168},[4182],{"type":52,"value":4183},"original",{"type":46,"tag":151,"props":4185,"children":4186},{"style":174},[4187],{"type":52,"value":177},{"type":46,"tag":151,"props":4189,"children":4190},{"style":168},[4191],{"type":52,"value":704},{"type":46,"tag":151,"props":4193,"children":4194},{"style":174},[4195],{"type":52,"value":380},{"type":46,"tag":151,"props":4197,"children":4198},{"style":168},[4199],{"type":52,"value":4200}," m",{"type":46,"tag":151,"props":4202,"children":4203},{"style":174},[4204],{"type":52,"value":177},{"type":46,"tag":151,"props":4206,"children":4207},{"style":168},[4208],{"type":52,"value":2713},{"type":46,"tag":151,"props":4210,"children":4211},{"style":199},[4212],{"type":52,"value":724},{"type":46,"tag":151,"props":4214,"children":4215},{"style":174},[4216],{"type":52,"value":231},{"type":46,"tag":151,"props":4218,"children":4219},{"class":153,"line":607},[4220,4225],{"type":46,"tag":151,"props":4221,"children":4222},{"style":199},[4223],{"type":52,"value":4224},"        )",{"type":46,"tag":151,"props":4226,"children":4227},{"style":174},[4228],{"type":52,"value":231},{"type":46,"tag":151,"props":4230,"children":4231},{"class":153,"line":1023},[4232],{"type":46,"tag":151,"props":4233,"children":4234},{"style":199},[4235],{"type":52,"value":4024},{"type":46,"tag":151,"props":4237,"children":4238},{"class":153,"line":1073},[4239],{"type":46,"tag":151,"props":4240,"children":4241},{"style":174},[4242],{"type":52,"value":2122},{"type":46,"tag":151,"props":4244,"children":4245},{"class":153,"line":1098},[4246,4251,4255,4259,4263,4267,4271,4275],{"type":46,"tag":151,"props":4247,"children":4248},{"style":180},[4249],{"type":52,"value":4250},"    onDelete",{"type":46,"tag":151,"props":4252,"children":4253},{"style":174},[4254],{"type":52,"value":207},{"type":46,"tag":151,"props":4256,"children":4257},{"style":727},[4258],{"type":52,"value":1619},{"type":46,"tag":151,"props":4260,"children":4261},{"style":174},[4262],{"type":52,"value":1931},{"type":46,"tag":151,"props":4264,"children":4265},{"style":716},[4266],{"type":52,"value":1640},{"type":46,"tag":151,"props":4268,"children":4269},{"style":174},[4270],{"type":52,"value":1645},{"type":46,"tag":151,"props":4272,"children":4273},{"style":727},[4274],{"type":52,"value":730},{"type":46,"tag":151,"props":4276,"children":4277},{"style":174},[4278],{"type":52,"value":735},{"type":46,"tag":151,"props":4280,"children":4281},{"class":153,"line":1133},[4282,4286,4290,4294,4298],{"type":46,"tag":151,"props":4283,"children":4284},{"style":1356},[4285],{"type":52,"value":2174},{"type":46,"tag":151,"props":4287,"children":4288},{"style":1426},[4289],{"type":52,"value":2236},{"type":46,"tag":151,"props":4291,"children":4292},{"style":174},[4293],{"type":52,"value":177},{"type":46,"tag":151,"props":4295,"children":4296},{"style":180},[4297],{"type":52,"value":2245},{"type":46,"tag":151,"props":4299,"children":4300},{"style":199},[4301],{"type":52,"value":1000},{"type":46,"tag":151,"props":4303,"children":4304},{"class":153,"line":1142},[4305,4309,4313,4317,4321,4325,4329,4333,4337,4341,4345,4349,4353,4357,4361,4365,4369,4373,4377,4381,4385,4389,4393],{"type":46,"tag":151,"props":4306,"children":4307},{"style":168},[4308],{"type":52,"value":3932},{"type":46,"tag":151,"props":4310,"children":4311},{"style":174},[4312],{"type":52,"value":177},{"type":46,"tag":151,"props":4314,"children":4315},{"style":168},[4316],{"type":52,"value":2635},{"type":46,"tag":151,"props":4318,"children":4319},{"style":174},[4320],{"type":52,"value":177},{"type":46,"tag":151,"props":4322,"children":4323},{"style":180},[4324],{"type":52,"value":3949},{"type":46,"tag":151,"props":4326,"children":4327},{"style":199},[4328],{"type":52,"value":187},{"type":46,"tag":151,"props":4330,"children":4331},{"style":174},[4332],{"type":52,"value":187},{"type":46,"tag":151,"props":4334,"children":4335},{"style":716},[4336],{"type":52,"value":3962},{"type":46,"tag":151,"props":4338,"children":4339},{"style":174},[4340],{"type":52,"value":724},{"type":46,"tag":151,"props":4342,"children":4343},{"style":727},[4344],{"type":52,"value":730},{"type":46,"tag":151,"props":4346,"children":4347},{"style":168},[4348],{"type":52,"value":1666},{"type":46,"tag":151,"props":4350,"children":4351},{"style":174},[4352],{"type":52,"value":177},{"type":46,"tag":151,"props":4354,"children":4355},{"style":168},[4356],{"type":52,"value":3756},{"type":46,"tag":151,"props":4358,"children":4359},{"style":174},[4360],{"type":52,"value":177},{"type":46,"tag":151,"props":4362,"children":4363},{"style":180},[4364],{"type":52,"value":1150},{"type":46,"tag":151,"props":4366,"children":4367},{"style":199},[4368],{"type":52,"value":187},{"type":46,"tag":151,"props":4370,"children":4371},{"style":168},[4372],{"type":52,"value":3962},{"type":46,"tag":151,"props":4374,"children":4375},{"style":174},[4376],{"type":52,"value":177},{"type":46,"tag":151,"props":4378,"children":4379},{"style":168},[4380],{"type":52,"value":4183},{"type":46,"tag":151,"props":4382,"children":4383},{"style":174},[4384],{"type":52,"value":177},{"type":46,"tag":151,"props":4386,"children":4387},{"style":168},[4388],{"type":52,"value":704},{"type":46,"tag":151,"props":4390,"children":4391},{"style":199},[4392],{"type":52,"value":4012},{"type":46,"tag":151,"props":4394,"children":4395},{"style":174},[4396],{"type":52,"value":231},{"type":46,"tag":151,"props":4398,"children":4400},{"class":153,"line":4399},22,[4401],{"type":46,"tag":151,"props":4402,"children":4403},{"style":199},[4404],{"type":52,"value":4024},{"type":46,"tag":151,"props":4406,"children":4408},{"class":153,"line":4407},23,[4409],{"type":46,"tag":151,"props":4410,"children":4411},{"style":174},[4412],{"type":52,"value":2122},{"type":46,"tag":151,"props":4414,"children":4416},{"class":153,"line":4415},24,[4417,4421,4425],{"type":46,"tag":151,"props":4418,"children":4419},{"style":174},[4420],{"type":52,"value":950},{"type":46,"tag":151,"props":4422,"children":4423},{"style":168},[4424],{"type":52,"value":724},{"type":46,"tag":151,"props":4426,"children":4427},{"style":174},[4428],{"type":52,"value":231},{"type":46,"tag":151,"props":4430,"children":4432},{"class":153,"line":4431},25,[4433],{"type":46,"tag":151,"props":4434,"children":4435},{"style":168},[4436],{"type":52,"value":301},{"type":46,"tag":59,"props":4438,"children":4439},{},[4440,4442,4448],{"type":52,"value":4441},"For ElectricCollection, return ",{"type":46,"tag":71,"props":4443,"children":4445},{"className":4444},[],[4446],{"type":52,"value":4447},"{ txid }",{"type":52,"value":4449}," instead of refetching:",{"type":46,"tag":140,"props":4451,"children":4453},{"className":142,"code":4452,"language":144,"meta":145,"style":145},"onUpdate: async ({ transaction }) => {\n  const txids = await Promise.all(\n    transaction.mutations.map(async (m) => {\n      const res = await api.todos.update(m.original.id, m.changes)\n      return res.txid\n    }),\n  )\n  return { txid: txids }\n}\n",[4454],{"type":46,"tag":71,"props":4455,"children":4456},{"__ignoreMap":145},[4457,4492,4530,4583,4668,4689,4704,4712,4742],{"type":46,"tag":151,"props":4458,"children":4459},{"class":153,"line":154},[4460,4464,4468,4472,4476,4480,4484,4488],{"type":46,"tag":151,"props":4461,"children":4462},{"style":1426},[4463],{"type":52,"value":100},{"type":46,"tag":151,"props":4465,"children":4466},{"style":174},[4467],{"type":52,"value":207},{"type":46,"tag":151,"props":4469,"children":4470},{"style":727},[4471],{"type":52,"value":1619},{"type":46,"tag":151,"props":4473,"children":4474},{"style":174},[4475],{"type":52,"value":1931},{"type":46,"tag":151,"props":4477,"children":4478},{"style":716},[4479],{"type":52,"value":1640},{"type":46,"tag":151,"props":4481,"children":4482},{"style":174},[4483],{"type":52,"value":1645},{"type":46,"tag":151,"props":4485,"children":4486},{"style":727},[4487],{"type":52,"value":730},{"type":46,"tag":151,"props":4489,"children":4490},{"style":174},[4491],{"type":52,"value":735},{"type":46,"tag":151,"props":4493,"children":4494},{"class":153,"line":164},[4495,4500,4505,4509,4514,4518,4522,4526],{"type":46,"tag":151,"props":4496,"children":4497},{"style":727},[4498],{"type":52,"value":4499},"  const",{"type":46,"tag":151,"props":4501,"children":4502},{"style":168},[4503],{"type":52,"value":4504}," txids",{"type":46,"tag":151,"props":4506,"children":4507},{"style":174},[4508],{"type":52,"value":757},{"type":46,"tag":151,"props":4510,"children":4511},{"style":1356},[4512],{"type":52,"value":4513}," await",{"type":46,"tag":151,"props":4515,"children":4516},{"style":1426},[4517],{"type":52,"value":2236},{"type":46,"tag":151,"props":4519,"children":4520},{"style":174},[4521],{"type":52,"value":177},{"type":46,"tag":151,"props":4523,"children":4524},{"style":180},[4525],{"type":52,"value":2245},{"type":46,"tag":151,"props":4527,"children":4528},{"style":199},[4529],{"type":52,"value":1000},{"type":46,"tag":151,"props":4531,"children":4532},{"class":153,"line":195},[4533,4538,4542,4546,4550,4554,4558,4563,4567,4571,4575,4579],{"type":46,"tag":151,"props":4534,"children":4535},{"style":168},[4536],{"type":52,"value":4537},"    transaction",{"type":46,"tag":151,"props":4539,"children":4540},{"style":174},[4541],{"type":52,"value":177},{"type":46,"tag":151,"props":4543,"children":4544},{"style":168},[4545],{"type":52,"value":2635},{"type":46,"tag":151,"props":4547,"children":4548},{"style":174},[4549],{"type":52,"value":177},{"type":46,"tag":151,"props":4551,"children":4552},{"style":180},[4553],{"type":52,"value":3949},{"type":46,"tag":151,"props":4555,"children":4556},{"style":199},[4557],{"type":52,"value":187},{"type":46,"tag":151,"props":4559,"children":4560},{"style":727},[4561],{"type":52,"value":4562},"async",{"type":46,"tag":151,"props":4564,"children":4565},{"style":174},[4566],{"type":52,"value":713},{"type":46,"tag":151,"props":4568,"children":4569},{"style":716},[4570],{"type":52,"value":3962},{"type":46,"tag":151,"props":4572,"children":4573},{"style":174},[4574],{"type":52,"value":724},{"type":46,"tag":151,"props":4576,"children":4577},{"style":727},[4578],{"type":52,"value":730},{"type":46,"tag":151,"props":4580,"children":4581},{"style":174},[4582],{"type":52,"value":735},{"type":46,"tag":151,"props":4584,"children":4585},{"class":153,"line":234},[4586,4591,4596,4600,4604,4608,4612,4616,4620,4624,4628,4632,4636,4640,4644,4648,4652,4656,4660,4664],{"type":46,"tag":151,"props":4587,"children":4588},{"style":727},[4589],{"type":52,"value":4590},"      const",{"type":46,"tag":151,"props":4592,"children":4593},{"style":168},[4594],{"type":52,"value":4595}," res",{"type":46,"tag":151,"props":4597,"children":4598},{"style":174},[4599],{"type":52,"value":757},{"type":46,"tag":151,"props":4601,"children":4602},{"style":1356},[4603],{"type":52,"value":4513},{"type":46,"tag":151,"props":4605,"children":4606},{"style":168},[4607],{"type":52,"value":1666},{"type":46,"tag":151,"props":4609,"children":4610},{"style":174},[4611],{"type":52,"value":177},{"type":46,"tag":151,"props":4613,"children":4614},{"style":168},[4615],{"type":52,"value":3756},{"type":46,"tag":151,"props":4617,"children":4618},{"style":174},[4619],{"type":52,"value":177},{"type":46,"tag":151,"props":4621,"children":4622},{"style":180},[4623],{"type":52,"value":690},{"type":46,"tag":151,"props":4625,"children":4626},{"style":199},[4627],{"type":52,"value":187},{"type":46,"tag":151,"props":4629,"children":4630},{"style":168},[4631],{"type":52,"value":3962},{"type":46,"tag":151,"props":4633,"children":4634},{"style":174},[4635],{"type":52,"value":177},{"type":46,"tag":151,"props":4637,"children":4638},{"style":168},[4639],{"type":52,"value":4183},{"type":46,"tag":151,"props":4641,"children":4642},{"style":174},[4643],{"type":52,"value":177},{"type":46,"tag":151,"props":4645,"children":4646},{"style":168},[4647],{"type":52,"value":704},{"type":46,"tag":151,"props":4649,"children":4650},{"style":174},[4651],{"type":52,"value":380},{"type":46,"tag":151,"props":4653,"children":4654},{"style":168},[4655],{"type":52,"value":4200},{"type":46,"tag":151,"props":4657,"children":4658},{"style":174},[4659],{"type":52,"value":177},{"type":46,"tag":151,"props":4661,"children":4662},{"style":168},[4663],{"type":52,"value":2713},{"type":46,"tag":151,"props":4665,"children":4666},{"style":199},[4667],{"type":52,"value":301},{"type":46,"tag":151,"props":4669,"children":4670},{"class":153,"line":267},[4671,4676,4680,4684],{"type":46,"tag":151,"props":4672,"children":4673},{"style":1356},[4674],{"type":52,"value":4675},"      return",{"type":46,"tag":151,"props":4677,"children":4678},{"style":168},[4679],{"type":52,"value":4595},{"type":46,"tag":151,"props":4681,"children":4682},{"style":174},[4683],{"type":52,"value":177},{"type":46,"tag":151,"props":4685,"children":4686},{"style":168},[4687],{"type":52,"value":4688},"txid\n",{"type":46,"tag":151,"props":4690,"children":4691},{"class":153,"line":290},[4692,4696,4700],{"type":46,"tag":151,"props":4693,"children":4694},{"style":174},[4695],{"type":52,"value":1591},{"type":46,"tag":151,"props":4697,"children":4698},{"style":199},[4699],{"type":52,"value":724},{"type":46,"tag":151,"props":4701,"children":4702},{"style":174},[4703],{"type":52,"value":231},{"type":46,"tag":151,"props":4705,"children":4706},{"class":153,"line":304},[4707],{"type":46,"tag":151,"props":4708,"children":4709},{"style":199},[4710],{"type":52,"value":4711},"  )\n",{"type":46,"tag":151,"props":4713,"children":4714},{"class":153,"line":314},[4715,4720,4724,4729,4733,4737],{"type":46,"tag":151,"props":4716,"children":4717},{"style":1356},[4718],{"type":52,"value":4719},"  return",{"type":46,"tag":151,"props":4721,"children":4722},{"style":174},[4723],{"type":52,"value":556},{"type":46,"tag":151,"props":4725,"children":4726},{"style":199},[4727],{"type":52,"value":4728}," txid",{"type":46,"tag":151,"props":4730,"children":4731},{"style":174},[4732],{"type":52,"value":207},{"type":46,"tag":151,"props":4734,"children":4735},{"style":168},[4736],{"type":52,"value":4504},{"type":46,"tag":151,"props":4738,"children":4739},{"style":174},[4740],{"type":52,"value":4741}," }\n",{"type":46,"tag":151,"props":4743,"children":4744},{"class":153,"line":323},[4745],{"type":46,"tag":151,"props":4746,"children":4747},{"style":174},[4748],{"type":52,"value":4749},"}\n",{"type":46,"tag":123,"props":4751,"children":4752},{},[],{"type":46,"tag":127,"props":4754,"children":4756},{"id":4755},"common-mistakes",[4757],{"type":52,"value":4758},"Common Mistakes",{"type":46,"tag":134,"props":4760,"children":4762},{"id":4761},"critical-passing-an-object-to-update-instead-of-a-draft-callback",[4763],{"type":52,"value":4764},"CRITICAL: Passing an object to update() instead of a draft callback",{"type":46,"tag":140,"props":4766,"children":4768},{"className":142,"code":4767,"language":144,"meta":145,"style":145},"\u002F\u002F WRONG -- silently fails or throws\ncollection.update(id, { ...item, title: 'new' })\n\n\u002F\u002F CORRECT -- mutate the draft proxy\ncollection.update(id, (draft) => {\n  draft.title = 'new'\n})\n",[4769],{"type":46,"tag":71,"props":4770,"children":4771},{"__ignoreMap":145},[4772,4780,4853,4860,4868,4911,4943],{"type":46,"tag":151,"props":4773,"children":4774},{"class":153,"line":154},[4775],{"type":46,"tag":151,"props":4776,"children":4777},{"style":158},[4778],{"type":52,"value":4779},"\u002F\u002F WRONG -- silently fails or throws\n",{"type":46,"tag":151,"props":4781,"children":4782},{"class":153,"line":164},[4783,4788,4792,4796,4801,4805,4809,4814,4819,4823,4828,4832,4836,4841,4845,4849],{"type":46,"tag":151,"props":4784,"children":4785},{"style":168},[4786],{"type":52,"value":4787},"collection",{"type":46,"tag":151,"props":4789,"children":4790},{"style":174},[4791],{"type":52,"value":177},{"type":46,"tag":151,"props":4793,"children":4794},{"style":180},[4795],{"type":52,"value":690},{"type":46,"tag":151,"props":4797,"children":4798},{"style":168},[4799],{"type":52,"value":4800},"(id",{"type":46,"tag":151,"props":4802,"children":4803},{"style":174},[4804],{"type":52,"value":380},{"type":46,"tag":151,"props":4806,"children":4807},{"style":174},[4808],{"type":52,"value":556},{"type":46,"tag":151,"props":4810,"children":4811},{"style":174},[4812],{"type":52,"value":4813}," ...",{"type":46,"tag":151,"props":4815,"children":4816},{"style":168},[4817],{"type":52,"value":4818},"item",{"type":46,"tag":151,"props":4820,"children":4821},{"style":174},[4822],{"type":52,"value":380},{"type":46,"tag":151,"props":4824,"children":4825},{"style":199},[4826],{"type":52,"value":4827}," title",{"type":46,"tag":151,"props":4829,"children":4830},{"style":174},[4831],{"type":52,"value":207},{"type":46,"tag":151,"props":4833,"children":4834},{"style":174},[4835],{"type":52,"value":249},{"type":46,"tag":151,"props":4837,"children":4838},{"style":252},[4839],{"type":52,"value":4840},"new",{"type":46,"tag":151,"props":4842,"children":4843},{"style":174},[4844],{"type":52,"value":260},{"type":46,"tag":151,"props":4846,"children":4847},{"style":174},[4848],{"type":52,"value":596},{"type":46,"tag":151,"props":4850,"children":4851},{"style":168},[4852],{"type":52,"value":301},{"type":46,"tag":151,"props":4854,"children":4855},{"class":153,"line":195},[4856],{"type":46,"tag":151,"props":4857,"children":4858},{"emptyLinePlaceholder":308},[4859],{"type":52,"value":311},{"type":46,"tag":151,"props":4861,"children":4862},{"class":153,"line":234},[4863],{"type":46,"tag":151,"props":4864,"children":4865},{"style":158},[4866],{"type":52,"value":4867},"\u002F\u002F CORRECT -- mutate the draft proxy\n",{"type":46,"tag":151,"props":4869,"children":4870},{"class":153,"line":267},[4871,4875,4879,4883,4887,4891,4895,4899,4903,4907],{"type":46,"tag":151,"props":4872,"children":4873},{"style":168},[4874],{"type":52,"value":4787},{"type":46,"tag":151,"props":4876,"children":4877},{"style":174},[4878],{"type":52,"value":177},{"type":46,"tag":151,"props":4880,"children":4881},{"style":180},[4882],{"type":52,"value":690},{"type":46,"tag":151,"props":4884,"children":4885},{"style":168},[4886],{"type":52,"value":4800},{"type":46,"tag":151,"props":4888,"children":4889},{"style":174},[4890],{"type":52,"value":380},{"type":46,"tag":151,"props":4892,"children":4893},{"style":174},[4894],{"type":52,"value":713},{"type":46,"tag":151,"props":4896,"children":4897},{"style":716},[4898],{"type":52,"value":719},{"type":46,"tag":151,"props":4900,"children":4901},{"style":174},[4902],{"type":52,"value":724},{"type":46,"tag":151,"props":4904,"children":4905},{"style":727},[4906],{"type":52,"value":730},{"type":46,"tag":151,"props":4908,"children":4909},{"style":174},[4910],{"type":52,"value":735},{"type":46,"tag":151,"props":4912,"children":4913},{"class":153,"line":290},[4914,4918,4922,4927,4931,4935,4939],{"type":46,"tag":151,"props":4915,"children":4916},{"style":168},[4917],{"type":52,"value":743},{"type":46,"tag":151,"props":4919,"children":4920},{"style":174},[4921],{"type":52,"value":177},{"type":46,"tag":151,"props":4923,"children":4924},{"style":168},[4925],{"type":52,"value":4926},"title",{"type":46,"tag":151,"props":4928,"children":4929},{"style":174},[4930],{"type":52,"value":757},{"type":46,"tag":151,"props":4932,"children":4933},{"style":174},[4934],{"type":52,"value":249},{"type":46,"tag":151,"props":4936,"children":4937},{"style":252},[4938],{"type":52,"value":4840},{"type":46,"tag":151,"props":4940,"children":4941},{"style":174},[4942],{"type":52,"value":1130},{"type":46,"tag":151,"props":4944,"children":4945},{"class":153,"line":304},[4946,4950],{"type":46,"tag":151,"props":4947,"children":4948},{"style":174},[4949],{"type":52,"value":296},{"type":46,"tag":151,"props":4951,"children":4952},{"style":168},[4953],{"type":52,"value":301},{"type":46,"tag":134,"props":4955,"children":4957},{"id":4956},"critical-hallucinating-mutation-api-signatures",[4958],{"type":52,"value":4959},"CRITICAL: Hallucinating mutation API signatures",{"type":46,"tag":59,"props":4961,"children":4962},{},[4963],{"type":52,"value":4964},"The most common AI-generated errors:",{"type":46,"tag":4966,"props":4967,"children":4968},"ul",{},[4969,4983,5002,5037],{"type":46,"tag":4970,"props":4971,"children":4972},"li",{},[4973,4975,4981],{"type":52,"value":4974},"Inventing handler signatures (e.g. ",{"type":46,"tag":71,"props":4976,"children":4978},{"className":4977},[],[4979],{"type":52,"value":4980},"onMutate",{"type":52,"value":4982}," on a collection config)",{"type":46,"tag":4970,"props":4984,"children":4985},{},[4986,4988,4994,4996],{"type":52,"value":4987},"Confusing ",{"type":46,"tag":71,"props":4989,"children":4991},{"className":4990},[],[4992],{"type":52,"value":4993},"createOptimisticAction",{"type":52,"value":4995}," with ",{"type":46,"tag":71,"props":4997,"children":4999},{"className":4998},[],[5000],{"type":52,"value":5001},"createTransaction",{"type":46,"tag":4970,"props":5003,"children":5004},{},[5005,5007,5013,5015,5021,5023,5029,5030,5036],{"type":52,"value":5006},"Wrong PendingMutation property names (",{"type":46,"tag":71,"props":5008,"children":5010},{"className":5009},[],[5011],{"type":52,"value":5012},"mutation.data",{"type":52,"value":5014}," does not exist --\nuse ",{"type":46,"tag":71,"props":5016,"children":5018},{"className":5017},[],[5019],{"type":52,"value":5020},"mutation.modified",{"type":52,"value":5022},", ",{"type":46,"tag":71,"props":5024,"children":5026},{"className":5025},[],[5027],{"type":52,"value":5028},"mutation.changes",{"type":52,"value":5022},{"type":46,"tag":71,"props":5031,"children":5033},{"className":5032},[],[5034],{"type":52,"value":5035},"mutation.original",{"type":52,"value":724},{"type":46,"tag":4970,"props":5038,"children":5039},{},[5040],{"type":52,"value":5041},"Missing the ambient transaction pattern",{"type":46,"tag":59,"props":5043,"children":5044},{},[5045,5047,5053],{"type":52,"value":5046},"Always reference the exact types in ",{"type":46,"tag":71,"props":5048,"children":5050},{"className":5049},[],[5051],{"type":52,"value":5052},"references\u002Ftransaction-api.md",{"type":52,"value":177},{"type":46,"tag":134,"props":5055,"children":5057},{"id":5056},"critical-onmutate-returning-a-promise",[5058],{"type":52,"value":5059},"CRITICAL: onMutate returning a Promise",{"type":46,"tag":59,"props":5061,"children":5062},{},[5063,5068,5070,5075,5076,5081,5083,5089],{"type":46,"tag":71,"props":5064,"children":5066},{"className":5065},[],[5067],{"type":52,"value":4980},{"type":52,"value":5069}," in ",{"type":46,"tag":71,"props":5071,"children":5073},{"className":5072},[],[5074],{"type":52,"value":4993},{"type":52,"value":69},{"type":46,"tag":63,"props":5077,"children":5078},{},[5079],{"type":52,"value":5080},"must be synchronous",{"type":52,"value":5082},". Optimistic state\nis applied in the current tick. Returning a Promise throws\n",{"type":46,"tag":71,"props":5084,"children":5086},{"className":5085},[],[5087],{"type":52,"value":5088},"OnMutateMustBeSynchronousError",{"type":52,"value":177},{"type":46,"tag":140,"props":5091,"children":5093},{"className":142,"code":5092,"language":144,"meta":145,"style":145},"\u002F\u002F WRONG\ncreateOptimisticAction({\n  onMutate: async (text) => {\n    collection.insert({ id: await generateId(), text })\n  },\n  ...\n})\n\n\u002F\u002F CORRECT\ncreateOptimisticAction({\n  onMutate: (text) => {\n    collection.insert({ id: crypto.randomUUID(), text })\n  },\n  ...\n})\n",[5094],{"type":46,"tag":71,"props":5095,"children":5096},{"__ignoreMap":145},[5097,5105,5120,5155,5216,5223,5231,5242,5249,5257,5272,5303,5366,5373,5380],{"type":46,"tag":151,"props":5098,"children":5099},{"class":153,"line":154},[5100],{"type":46,"tag":151,"props":5101,"children":5102},{"style":158},[5103],{"type":52,"value":5104},"\u002F\u002F WRONG\n",{"type":46,"tag":151,"props":5106,"children":5107},{"class":153,"line":164},[5108,5112,5116],{"type":46,"tag":151,"props":5109,"children":5110},{"style":180},[5111],{"type":52,"value":4993},{"type":46,"tag":151,"props":5113,"children":5114},{"style":168},[5115],{"type":52,"value":187},{"type":46,"tag":151,"props":5117,"children":5118},{"style":174},[5119],{"type":52,"value":192},{"type":46,"tag":151,"props":5121,"children":5122},{"class":153,"line":195},[5123,5127,5131,5135,5139,5143,5147,5151],{"type":46,"tag":151,"props":5124,"children":5125},{"style":180},[5126],{"type":52,"value":1458},{"type":46,"tag":151,"props":5128,"children":5129},{"style":174},[5130],{"type":52,"value":207},{"type":46,"tag":151,"props":5132,"children":5133},{"style":727},[5134],{"type":52,"value":1619},{"type":46,"tag":151,"props":5136,"children":5137},{"style":174},[5138],{"type":52,"value":713},{"type":46,"tag":151,"props":5140,"children":5141},{"style":716},[5142],{"type":52,"value":52},{"type":46,"tag":151,"props":5144,"children":5145},{"style":174},[5146],{"type":52,"value":724},{"type":46,"tag":151,"props":5148,"children":5149},{"style":727},[5150],{"type":52,"value":730},{"type":46,"tag":151,"props":5152,"children":5153},{"style":174},[5154],{"type":52,"value":735},{"type":46,"tag":151,"props":5156,"children":5157},{"class":153,"line":234},[5158,5163,5167,5171,5175,5179,5183,5187,5191,5196,5200,5204,5208,5212],{"type":46,"tag":151,"props":5159,"children":5160},{"style":168},[5161],{"type":52,"value":5162},"    collection",{"type":46,"tag":151,"props":5164,"children":5165},{"style":174},[5166],{"type":52,"value":177},{"type":46,"tag":151,"props":5168,"children":5169},{"style":180},[5170],{"type":52,"value":136},{"type":46,"tag":151,"props":5172,"children":5173},{"style":199},[5174],{"type":52,"value":187},{"type":46,"tag":151,"props":5176,"children":5177},{"style":174},[5178],{"type":52,"value":1980},{"type":46,"tag":151,"props":5180,"children":5181},{"style":199},[5182],{"type":52,"value":355},{"type":46,"tag":151,"props":5184,"children":5185},{"style":174},[5186],{"type":52,"value":207},{"type":46,"tag":151,"props":5188,"children":5189},{"style":1356},[5190],{"type":52,"value":4513},{"type":46,"tag":151,"props":5192,"children":5193},{"style":180},[5194],{"type":52,"value":5195}," generateId",{"type":46,"tag":151,"props":5197,"children":5198},{"style":199},[5199],{"type":52,"value":226},{"type":46,"tag":151,"props":5201,"children":5202},{"style":174},[5203],{"type":52,"value":380},{"type":46,"tag":151,"props":5205,"children":5206},{"style":168},[5207],{"type":52,"value":385},{"type":46,"tag":151,"props":5209,"children":5210},{"style":174},[5211],{"type":52,"value":596},{"type":46,"tag":151,"props":5213,"children":5214},{"style":199},[5215],{"type":52,"value":301},{"type":46,"tag":151,"props":5217,"children":5218},{"class":153,"line":267},[5219],{"type":46,"tag":151,"props":5220,"children":5221},{"style":174},[5222],{"type":52,"value":1139},{"type":46,"tag":151,"props":5224,"children":5225},{"class":153,"line":290},[5226],{"type":46,"tag":151,"props":5227,"children":5228},{"style":174},[5229],{"type":52,"value":5230},"  ...\n",{"type":46,"tag":151,"props":5232,"children":5233},{"class":153,"line":304},[5234,5238],{"type":46,"tag":151,"props":5235,"children":5236},{"style":174},[5237],{"type":52,"value":296},{"type":46,"tag":151,"props":5239,"children":5240},{"style":168},[5241],{"type":52,"value":301},{"type":46,"tag":151,"props":5243,"children":5244},{"class":153,"line":314},[5245],{"type":46,"tag":151,"props":5246,"children":5247},{"emptyLinePlaceholder":308},[5248],{"type":52,"value":311},{"type":46,"tag":151,"props":5250,"children":5251},{"class":153,"line":323},[5252],{"type":46,"tag":151,"props":5253,"children":5254},{"style":158},[5255],{"type":52,"value":5256},"\u002F\u002F CORRECT\n",{"type":46,"tag":151,"props":5258,"children":5259},{"class":153,"line":344},[5260,5264,5268],{"type":46,"tag":151,"props":5261,"children":5262},{"style":180},[5263],{"type":52,"value":4993},{"type":46,"tag":151,"props":5265,"children":5266},{"style":168},[5267],{"type":52,"value":187},{"type":46,"tag":151,"props":5269,"children":5270},{"style":174},[5271],{"type":52,"value":192},{"type":46,"tag":151,"props":5273,"children":5274},{"class":153,"line":426},[5275,5279,5283,5287,5291,5295,5299],{"type":46,"tag":151,"props":5276,"children":5277},{"style":180},[5278],{"type":52,"value":1458},{"type":46,"tag":151,"props":5280,"children":5281},{"style":174},[5282],{"type":52,"value":207},{"type":46,"tag":151,"props":5284,"children":5285},{"style":174},[5286],{"type":52,"value":713},{"type":46,"tag":151,"props":5288,"children":5289},{"style":716},[5290],{"type":52,"value":52},{"type":46,"tag":151,"props":5292,"children":5293},{"style":174},[5294],{"type":52,"value":724},{"type":46,"tag":151,"props":5296,"children":5297},{"style":727},[5298],{"type":52,"value":730},{"type":46,"tag":151,"props":5300,"children":5301},{"style":174},[5302],{"type":52,"value":735},{"type":46,"tag":151,"props":5304,"children":5305},{"class":153,"line":503},[5306,5310,5314,5318,5322,5326,5330,5334,5338,5342,5346,5350,5354,5358,5362],{"type":46,"tag":151,"props":5307,"children":5308},{"style":168},[5309],{"type":52,"value":5162},{"type":46,"tag":151,"props":5311,"children":5312},{"style":174},[5313],{"type":52,"value":177},{"type":46,"tag":151,"props":5315,"children":5316},{"style":180},[5317],{"type":52,"value":136},{"type":46,"tag":151,"props":5319,"children":5320},{"style":199},[5321],{"type":52,"value":187},{"type":46,"tag":151,"props":5323,"children":5324},{"style":174},[5325],{"type":52,"value":1980},{"type":46,"tag":151,"props":5327,"children":5328},{"style":199},[5329],{"type":52,"value":355},{"type":46,"tag":151,"props":5331,"children":5332},{"style":174},[5333],{"type":52,"value":207},{"type":46,"tag":151,"props":5335,"children":5336},{"style":168},[5337],{"type":52,"value":212},{"type":46,"tag":151,"props":5339,"children":5340},{"style":174},[5341],{"type":52,"value":177},{"type":46,"tag":151,"props":5343,"children":5344},{"style":180},[5345],{"type":52,"value":221},{"type":46,"tag":151,"props":5347,"children":5348},{"style":199},[5349],{"type":52,"value":226},{"type":46,"tag":151,"props":5351,"children":5352},{"style":174},[5353],{"type":52,"value":380},{"type":46,"tag":151,"props":5355,"children":5356},{"style":168},[5357],{"type":52,"value":385},{"type":46,"tag":151,"props":5359,"children":5360},{"style":174},[5361],{"type":52,"value":596},{"type":46,"tag":151,"props":5363,"children":5364},{"style":199},[5365],{"type":52,"value":301},{"type":46,"tag":151,"props":5367,"children":5368},{"class":153,"line":512},[5369],{"type":46,"tag":151,"props":5370,"children":5371},{"style":174},[5372],{"type":52,"value":1139},{"type":46,"tag":151,"props":5374,"children":5375},{"class":153,"line":520},[5376],{"type":46,"tag":151,"props":5377,"children":5378},{"style":174},[5379],{"type":52,"value":5230},{"type":46,"tag":151,"props":5381,"children":5382},{"class":153,"line":529},[5383,5387],{"type":46,"tag":151,"props":5384,"children":5385},{"style":174},[5386],{"type":52,"value":296},{"type":46,"tag":151,"props":5388,"children":5389},{"style":168},[5390],{"type":52,"value":301},{"type":46,"tag":134,"props":5392,"children":5394},{"id":5393},"critical-mutations-without-handler-or-ambient-transaction",[5395],{"type":52,"value":5396},"CRITICAL: Mutations without handler or ambient transaction",{"type":46,"tag":59,"props":5398,"children":5399},{},[5400],{"type":52,"value":5401},"Collection mutations require either:",{"type":46,"tag":5403,"props":5404,"children":5405},"ol",{},[5406,5430],{"type":46,"tag":4970,"props":5407,"children":5408},{},[5409,5411,5416,5417,5422,5423,5428],{"type":52,"value":5410},"An ",{"type":46,"tag":71,"props":5412,"children":5414},{"className":5413},[],[5415],{"type":52,"value":92},{"type":52,"value":94},{"type":46,"tag":71,"props":5418,"children":5420},{"className":5419},[],[5421],{"type":52,"value":100},{"type":52,"value":94},{"type":46,"tag":71,"props":5424,"children":5426},{"className":5425},[],[5427],{"type":52,"value":107},{"type":52,"value":5429}," handler on the collection, OR",{"type":46,"tag":4970,"props":5431,"children":5432},{},[5433,5435,5440,5441],{"type":52,"value":5434},"An ambient transaction from ",{"type":46,"tag":71,"props":5436,"children":5438},{"className":5437},[],[5439],{"type":52,"value":5001},{"type":52,"value":94},{"type":46,"tag":71,"props":5442,"children":5444},{"className":5443},[],[5445],{"type":52,"value":4993},{"type":46,"tag":59,"props":5447,"children":5448},{},[5449,5451,5457],{"type":52,"value":5450},"Without either, throws ",{"type":46,"tag":71,"props":5452,"children":5454},{"className":5453},[],[5455],{"type":52,"value":5456},"MissingInsertHandlerError",{"type":52,"value":5458}," (or the Update\u002FDelete variant).",{"type":46,"tag":134,"props":5460,"children":5462},{"id":5461},"high-calling-mutate-after-transaction-is-no-longer-pending",[5463],{"type":52,"value":5464},"HIGH: Calling .mutate() after transaction is no longer pending",{"type":46,"tag":59,"props":5466,"children":5467},{},[5468,5470,5476,5478,5484,5486,5492,5494,5500,5502,5508],{"type":52,"value":5469},"Transactions only accept new mutations while in ",{"type":46,"tag":71,"props":5471,"children":5473},{"className":5472},[],[5474],{"type":52,"value":5475},"pending",{"type":52,"value":5477}," state. Calling\n",{"type":46,"tag":71,"props":5479,"children":5481},{"className":5480},[],[5482],{"type":52,"value":5483},"mutate()",{"type":52,"value":5485}," after ",{"type":46,"tag":71,"props":5487,"children":5489},{"className":5488},[],[5490],{"type":52,"value":5491},"commit()",{"type":52,"value":5493}," or ",{"type":46,"tag":71,"props":5495,"children":5497},{"className":5496},[],[5498],{"type":52,"value":5499},"rollback()",{"type":52,"value":5501}," throws\n",{"type":46,"tag":71,"props":5503,"children":5505},{"className":5504},[],[5506],{"type":52,"value":5507},"TransactionNotPendingMutateError",{"type":52,"value":5509},". Create a new transaction instead.",{"type":46,"tag":134,"props":5511,"children":5513},{"id":5512},"high-changing-primary-key-via-update",[5514],{"type":52,"value":5515},"HIGH: Changing primary key via update",{"type":46,"tag":59,"props":5517,"children":5518},{},[5519,5521,5527],{"type":52,"value":5520},"The update proxy detects key changes and throws ",{"type":46,"tag":71,"props":5522,"children":5524},{"className":5523},[],[5525],{"type":52,"value":5526},"KeyUpdateNotAllowedError",{"type":52,"value":5528},".\nPrimary keys are immutable once set. If you need a different key, delete and\nre-insert.",{"type":46,"tag":134,"props":5530,"children":5532},{"id":5531},"high-inserting-item-with-duplicate-key",[5533],{"type":52,"value":5534},"HIGH: Inserting item with duplicate key",{"type":46,"tag":59,"props":5536,"children":5537},{},[5538,5540,5546,5548,5554],{"type":52,"value":5539},"If an item with the same key already exists (synced or optimistic), throws\n",{"type":46,"tag":71,"props":5541,"children":5543},{"className":5542},[],[5544],{"type":52,"value":5545},"DuplicateKeyError",{"type":52,"value":5547},". Always generate a unique key (e.g. ",{"type":46,"tag":71,"props":5549,"children":5551},{"className":5550},[],[5552],{"type":52,"value":5553},"crypto.randomUUID()",{"type":52,"value":5555},")\nor check before inserting.",{"type":46,"tag":134,"props":5557,"children":5559},{"id":5558},"high-manually-refetching-inside-a-query-collection-handler",[5560],{"type":52,"value":5561},"HIGH: Manually refetching inside a Query Collection handler",{"type":46,"tag":59,"props":5563,"children":5564},{},[5565,5567,5572,5573,5578,5580,5585,5587,5593],{"type":52,"value":5566},"Query Collection automatically refetches after ",{"type":46,"tag":71,"props":5568,"children":5570},{"className":5569},[],[5571],{"type":52,"value":92},{"type":52,"value":5022},{"type":46,"tag":71,"props":5574,"children":5576},{"className":5575},[],[5577],{"type":52,"value":100},{"type":52,"value":5579},", and\n",{"type":46,"tag":71,"props":5581,"children":5583},{"className":5582},[],[5584],{"type":52,"value":107},{"type":52,"value":5586}," complete, and waits for that refetch before the mutation finishes.\nCalling ",{"type":46,"tag":71,"props":5588,"children":5590},{"className":5589},[],[5591],{"type":52,"value":5592},"utils.refetch()",{"type":52,"value":5594}," inside the handler sends a redundant request.",{"type":46,"tag":140,"props":5596,"children":5598},{"className":142,"code":5597,"language":144,"meta":145,"style":145},"\u002F\u002F WRONG -- causes one manual and one automatic refetch\nonInsert: async ({ transaction }) => {\n  await api.createTodo(transaction.mutations[0].modified)\n  await collection.utils.refetch()\n}\n\n\u002F\u002F CORRECT -- automatic refetch is awaited after this returns\nonInsert: async ({ transaction }) => {\n  await api.createTodo(transaction.mutations[0].modified)\n}\n",[5599],{"type":46,"tag":71,"props":5600,"children":5601},{"__ignoreMap":145},[5602,5610,5645,5706,5738,5745,5752,5760,5795,5854],{"type":46,"tag":151,"props":5603,"children":5604},{"class":153,"line":154},[5605],{"type":46,"tag":151,"props":5606,"children":5607},{"style":158},[5608],{"type":52,"value":5609},"\u002F\u002F WRONG -- causes one manual and one automatic refetch\n",{"type":46,"tag":151,"props":5611,"children":5612},{"class":153,"line":164},[5613,5617,5621,5625,5629,5633,5637,5641],{"type":46,"tag":151,"props":5614,"children":5615},{"style":1426},[5616],{"type":52,"value":92},{"type":46,"tag":151,"props":5618,"children":5619},{"style":174},[5620],{"type":52,"value":207},{"type":46,"tag":151,"props":5622,"children":5623},{"style":727},[5624],{"type":52,"value":1619},{"type":46,"tag":151,"props":5626,"children":5627},{"style":174},[5628],{"type":52,"value":1931},{"type":46,"tag":151,"props":5630,"children":5631},{"style":716},[5632],{"type":52,"value":1640},{"type":46,"tag":151,"props":5634,"children":5635},{"style":174},[5636],{"type":52,"value":1645},{"type":46,"tag":151,"props":5638,"children":5639},{"style":727},[5640],{"type":52,"value":730},{"type":46,"tag":151,"props":5642,"children":5643},{"style":174},[5644],{"type":52,"value":735},{"type":46,"tag":151,"props":5646,"children":5647},{"class":153,"line":195},[5648,5653,5657,5661,5666,5670,5674,5678,5682,5686,5690,5694,5698,5702],{"type":46,"tag":151,"props":5649,"children":5650},{"style":1356},[5651],{"type":52,"value":5652},"  await",{"type":46,"tag":151,"props":5654,"children":5655},{"style":168},[5656],{"type":52,"value":1666},{"type":46,"tag":151,"props":5658,"children":5659},{"style":174},[5660],{"type":52,"value":177},{"type":46,"tag":151,"props":5662,"children":5663},{"style":180},[5664],{"type":52,"value":5665},"createTodo",{"type":46,"tag":151,"props":5667,"children":5668},{"style":199},[5669],{"type":52,"value":187},{"type":46,"tag":151,"props":5671,"children":5672},{"style":168},[5673],{"type":52,"value":3281},{"type":46,"tag":151,"props":5675,"children":5676},{"style":174},[5677],{"type":52,"value":177},{"type":46,"tag":151,"props":5679,"children":5680},{"style":168},[5681],{"type":52,"value":2635},{"type":46,"tag":151,"props":5683,"children":5684},{"style":199},[5685],{"type":52,"value":2640},{"type":46,"tag":151,"props":5687,"children":5688},{"style":1556},[5689],{"type":52,"value":2645},{"type":46,"tag":151,"props":5691,"children":5692},{"style":199},[5693],{"type":52,"value":3765},{"type":46,"tag":151,"props":5695,"children":5696},{"style":174},[5697],{"type":52,"value":177},{"type":46,"tag":151,"props":5699,"children":5700},{"style":168},[5701],{"type":52,"value":4007},{"type":46,"tag":151,"props":5703,"children":5704},{"style":199},[5705],{"type":52,"value":301},{"type":46,"tag":151,"props":5707,"children":5708},{"class":153,"line":234},[5709,5713,5718,5722,5726,5730,5734],{"type":46,"tag":151,"props":5710,"children":5711},{"style":1356},[5712],{"type":52,"value":5652},{"type":46,"tag":151,"props":5714,"children":5715},{"style":168},[5716],{"type":52,"value":5717}," collection",{"type":46,"tag":151,"props":5719,"children":5720},{"style":174},[5721],{"type":52,"value":177},{"type":46,"tag":151,"props":5723,"children":5724},{"style":168},[5725],{"type":52,"value":1725},{"type":46,"tag":151,"props":5727,"children":5728},{"style":174},[5729],{"type":52,"value":177},{"type":46,"tag":151,"props":5731,"children":5732},{"style":180},[5733],{"type":52,"value":1734},{"type":46,"tag":151,"props":5735,"children":5736},{"style":199},[5737],{"type":52,"value":797},{"type":46,"tag":151,"props":5739,"children":5740},{"class":153,"line":267},[5741],{"type":46,"tag":151,"props":5742,"children":5743},{"style":174},[5744],{"type":52,"value":4749},{"type":46,"tag":151,"props":5746,"children":5747},{"class":153,"line":290},[5748],{"type":46,"tag":151,"props":5749,"children":5750},{"emptyLinePlaceholder":308},[5751],{"type":52,"value":311},{"type":46,"tag":151,"props":5753,"children":5754},{"class":153,"line":304},[5755],{"type":46,"tag":151,"props":5756,"children":5757},{"style":158},[5758],{"type":52,"value":5759},"\u002F\u002F CORRECT -- automatic refetch is awaited after this returns\n",{"type":46,"tag":151,"props":5761,"children":5762},{"class":153,"line":314},[5763,5767,5771,5775,5779,5783,5787,5791],{"type":46,"tag":151,"props":5764,"children":5765},{"style":1426},[5766],{"type":52,"value":92},{"type":46,"tag":151,"props":5768,"children":5769},{"style":174},[5770],{"type":52,"value":207},{"type":46,"tag":151,"props":5772,"children":5773},{"style":727},[5774],{"type":52,"value":1619},{"type":46,"tag":151,"props":5776,"children":5777},{"style":174},[5778],{"type":52,"value":1931},{"type":46,"tag":151,"props":5780,"children":5781},{"style":716},[5782],{"type":52,"value":1640},{"type":46,"tag":151,"props":5784,"children":5785},{"style":174},[5786],{"type":52,"value":1645},{"type":46,"tag":151,"props":5788,"children":5789},{"style":727},[5790],{"type":52,"value":730},{"type":46,"tag":151,"props":5792,"children":5793},{"style":174},[5794],{"type":52,"value":735},{"type":46,"tag":151,"props":5796,"children":5797},{"class":153,"line":323},[5798,5802,5806,5810,5814,5818,5822,5826,5830,5834,5838,5842,5846,5850],{"type":46,"tag":151,"props":5799,"children":5800},{"style":1356},[5801],{"type":52,"value":5652},{"type":46,"tag":151,"props":5803,"children":5804},{"style":168},[5805],{"type":52,"value":1666},{"type":46,"tag":151,"props":5807,"children":5808},{"style":174},[5809],{"type":52,"value":177},{"type":46,"tag":151,"props":5811,"children":5812},{"style":180},[5813],{"type":52,"value":5665},{"type":46,"tag":151,"props":5815,"children":5816},{"style":199},[5817],{"type":52,"value":187},{"type":46,"tag":151,"props":5819,"children":5820},{"style":168},[5821],{"type":52,"value":3281},{"type":46,"tag":151,"props":5823,"children":5824},{"style":174},[5825],{"type":52,"value":177},{"type":46,"tag":151,"props":5827,"children":5828},{"style":168},[5829],{"type":52,"value":2635},{"type":46,"tag":151,"props":5831,"children":5832},{"style":199},[5833],{"type":52,"value":2640},{"type":46,"tag":151,"props":5835,"children":5836},{"style":1556},[5837],{"type":52,"value":2645},{"type":46,"tag":151,"props":5839,"children":5840},{"style":199},[5841],{"type":52,"value":3765},{"type":46,"tag":151,"props":5843,"children":5844},{"style":174},[5845],{"type":52,"value":177},{"type":46,"tag":151,"props":5847,"children":5848},{"style":168},[5849],{"type":52,"value":4007},{"type":46,"tag":151,"props":5851,"children":5852},{"style":199},[5853],{"type":52,"value":301},{"type":46,"tag":151,"props":5855,"children":5856},{"class":153,"line":344},[5857],{"type":46,"tag":151,"props":5858,"children":5859},{"style":174},[5860],{"type":52,"value":4749},{"type":46,"tag":59,"props":5862,"children":5863},{},[5864,5866,5872],{"type":52,"value":5865},"When the handler writes the confirmed server result with direct-write utilities,\nreturn ",{"type":46,"tag":71,"props":5867,"children":5869},{"className":5868},[],[5870],{"type":52,"value":5871},"{ refetch: false }",{"type":52,"value":5873}," to skip the automatic refetch.",{"type":46,"tag":123,"props":5875,"children":5876},{},[],{"type":46,"tag":127,"props":5878,"children":5880},{"id":5879},"tension-optimistic-speed-vs-data-consistency",[5881],{"type":52,"value":5882},"Tension: Optimistic Speed vs. Data Consistency",{"type":46,"tag":59,"props":5884,"children":5885},{},[5886],{"type":52,"value":5887},"Instant optimistic updates create a window where client state diverges from\nserver state. If the handler fails, the rollback removes the optimistic state --\nwhich can discard user work the user thought was saved. Consider:",{"type":46,"tag":4966,"props":5889,"children":5890},{},[5891,5896,5909,5914],{"type":46,"tag":4970,"props":5892,"children":5893},{},[5894],{"type":52,"value":5895},"Showing pending\u002Fsaving indicators so users know state is unconfirmed",{"type":46,"tag":4970,"props":5897,"children":5898},{},[5899,5901,5907],{"type":52,"value":5900},"Using ",{"type":46,"tag":71,"props":5902,"children":5904},{"className":5903},[],[5905],{"type":52,"value":5906},"{ optimistic: false }",{"type":52,"value":5908}," for destructive operations",{"type":46,"tag":4970,"props":5910,"children":5911},{},[5912],{"type":52,"value":5913},"Designing idempotent server endpoints so retries are safe",{"type":46,"tag":4970,"props":5915,"children":5916},{},[5917,5919,5924],{"type":52,"value":5918},"Handling ",{"type":46,"tag":71,"props":5920,"children":5922},{"className":5921},[],[5923],{"type":52,"value":1313},{"type":52,"value":5925}," rejection to surface errors to the user",{"type":46,"tag":123,"props":5927,"children":5928},{},[],{"type":46,"tag":127,"props":5930,"children":5932},{"id":5931},"references",[5933],{"type":52,"value":5934},"References",{"type":46,"tag":4966,"props":5936,"children":5937},{},[5938,5949],{"type":46,"tag":4970,"props":5939,"children":5940},{},[5941,5947],{"type":46,"tag":5942,"props":5943,"children":5944},"a",{"href":5052},[5945],{"type":52,"value":5946},"Transaction API Reference",{"type":52,"value":5948}," -- createTransaction config,\nTransaction object, PendingMutation type, mutation merging rules, strategy types",{"type":46,"tag":4970,"props":5950,"children":5951},{},[5952],{"type":46,"tag":5942,"props":5953,"children":5957},{"href":5954,"rel":5955},"https:\u002F\u002Ftanstack.com\u002Fdb\u002Flatest\u002Fdocs\u002Fguides\u002Fmutations",[5956],"nofollow",[5958],{"type":52,"value":5959},"TanStack DB Mutations Guide",{"type":46,"tag":5961,"props":5962,"children":5963},"style",{},[5964],{"type":52,"value":5965},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"items":5967,"total":512},[5968,5982,5994,6004,6017,6030,6036],{"slug":5969,"name":5969,"fn":5970,"description":5971,"org":5972,"tags":5973,"stars":21,"repoUrl":22,"updatedAt":5981},"angular-db","integrate TanStack DB with Angular","Angular bindings for TanStack DB. injectLiveQuery inject function with Angular signals (Signal\u003CT>) for all return values. Reactive params pattern ({ params: () => T, query: ({ params, q }) => QueryBuilder }) for dynamic queries. Must be called in injection context. Angular 17+ control flow (@if, @for) and signal inputs supported. Import from @tanstack\u002Fangular-db (re-exports all of @tanstack\u002Fdb).\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[5974,5977,5978],{"name":5975,"slug":5976,"type":16},"Angular","angular",{"name":14,"slug":15,"type":16},{"name":5979,"slug":5980,"type":16},"TypeScript","typescript","2026-07-16T06:01:16.345046",{"slug":5983,"name":5983,"fn":5984,"description":5985,"org":5986,"tags":5987,"stars":21,"repoUrl":22,"updatedAt":5993},"db-core","manage database collections with TanStack DB","TanStack DB core concepts: createCollection with queryCollectionOptions, electricCollectionOptions, powerSyncCollectionOptions, rxdbCollectionOptions, trailbaseCollectionOptions, localOnlyCollectionOptions. Live queries via query builder (from, where, join, select, groupBy, orderBy, limit). Optimistic mutations with draft proxy (collection.insert, collection.update, collection.delete). createOptimisticAction, createTransaction, createPacedMutations. Entry point for all TanStack DB skills.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[5988,5991,5992],{"name":5989,"slug":5990,"type":16},"Data Modeling","data-modeling",{"name":14,"slug":15,"type":16},{"name":10,"slug":9,"type":16},"2026-07-17T06:06:40.214285",{"slug":5995,"name":76,"fn":5996,"description":5997,"org":5998,"tags":5999,"stars":21,"repoUrl":22,"updatedAt":6003},"db-corecollection-setup","set up typed collections in TanStack DB","Creating typed collections with createCollection. Adapter selection: queryCollectionOptions (REST\u002FTanStack Query), electricCollectionOptions (ElectricSQL real-time sync), powerSyncCollectionOptions (PowerSync SQLite), rxdbCollectionOptions (RxDB), trailbaseCollectionOptions (TrailBase), localOnlyCollectionOptions, localStorageCollectionOptions. CollectionConfig options: getKey, schema, sync, gcTime, autoIndex (default off), defaultIndexType, syncMode (eager\u002Fon-demand, plus progressive for Electric). StandardSchema validation with Zod\u002FValibot\u002FArkType. Collection lifecycle (idle\u002Floading\u002Fready\u002Ferror). Adapter-specific sync patterns including Electric txid tracking, Query direct writes, and PowerSync query-driven sync with onLoad\u002FonLoadSubset hooks.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[6000,6001,6002],{"name":5989,"slug":5990,"type":16},{"name":14,"slug":15,"type":16},{"name":10,"slug":9,"type":16},"2026-07-26T05:48:58.321777",{"slug":6005,"name":6006,"fn":6007,"description":6008,"org":6009,"tags":6010,"stars":21,"repoUrl":22,"updatedAt":6016},"db-corecustom-adapter","db-core\u002Fcustom-adapter","build custom TanStack collection adapters","Building custom collection adapters for new backends. SyncConfig interface: sync function receiving begin, write, commit, markReady, truncate, metadata primitives. ChangeMessage format (insert, update, delete). loadSubset for on-demand sync. LoadSubsetOptions (where, orderBy, limit, cursor). Expression parsing: parseWhereExpression, parseOrderByExpression, extractSimpleComparisons, parseLoadSubsetOptions. Collection options creator pattern. rowUpdateMode (partial vs full). Subscription lifecycle and cleanup functions. Persisted sync metadata API (metadata.row and metadata.collection) for storing per-row and per-collection adapter state.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[6011,6012,6015],{"name":14,"slug":15,"type":16},{"name":6013,"slug":6014,"type":16},"Engineering","engineering",{"name":10,"slug":9,"type":16},"2026-07-16T06:04:06.862485",{"slug":6018,"name":6019,"fn":6020,"description":6021,"org":6022,"tags":6023,"stars":21,"repoUrl":22,"updatedAt":6029},"db-corelive-queries","db-core\u002Flive-queries","build live queries with TanStack DB","Query builder fluent API: from, where, join, leftJoin, rightJoin, innerJoin, fullJoin, select, fn.select, groupBy, having, orderBy, limit, offset, distinct, findOne. Operators: eq, gt, gte, lt, lte, like, ilike, inArray, isNull, isUndefined, and, or, not. Aggregates: count, sum, avg, min, max. String functions: upper, lower, length, concat. Utility: coalesce, caseWhen. Math: add. $selected namespace. createLiveQueryCollection. Derived collections. Predicate push-down. Incremental view maintenance via differential dataflow (d2ts). Virtual properties ($synced, $origin, $key, $collectionId). Includes subqueries for hierarchical data. toArray and concat(toArray(...)) scalar includes. queryOnce for one-shot queries. createEffect for reactive side effects (onEnter, onUpdate, onExit, onBatch).\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[6024,6025,6028],{"name":14,"slug":15,"type":16},{"name":6026,"slug":6027,"type":16},"SQL","sql",{"name":10,"slug":9,"type":16},"2026-07-16T06:04:08.757365",{"slug":4,"name":5,"fn":6,"description":7,"org":6031,"tags":6032,"stars":21,"repoUrl":22,"updatedAt":23},{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[6033,6034,6035],{"name":14,"slug":15,"type":16},{"name":19,"slug":20,"type":16},{"name":10,"slug":9,"type":16},{"slug":6037,"name":6038,"fn":6039,"description":6040,"org":6041,"tags":6042,"stars":21,"repoUrl":22,"updatedAt":6051},"db-corepersistence","db-core\u002Fpersistence","implement SQLite-backed persistence for TanStack DB","SQLite-backed persistence for TanStack DB collections. persistedCollectionOptions wraps any adapter (Electric, Query, PowerSync, or local-only) with durable local storage. Platform adapters: browser (WA-SQLite OPFS), React Native (op-sqlite), Expo (expo-sqlite), Electron (IPC), Node (better-sqlite3), Capacitor, Tauri, Cloudflare Durable Objects. Multi-tab\u002Fmulti-process coordination via BrowserCollectionCoordinator \u002F ElectronCollectionCoordinator \u002F SingleProcessCoordinator. schemaVersion for migration resets. Local-only mode for offline-first without a server.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[6043,6044,6047,6050],{"name":14,"slug":15,"type":16},{"name":6045,"slug":6046,"type":16},"Persistence","persistence",{"name":6048,"slug":6049,"type":16},"SQLite","sqlite",{"name":10,"slug":9,"type":16},"2026-07-17T06:06:39.182084",{"items":6053,"total":6193},[6054,6068,6080,6092,6107,6119,6129,6139,6152,6162,6173,6183],{"slug":6055,"name":6055,"fn":6056,"description":6057,"org":6058,"tags":6059,"stars":6065,"repoUrl":6066,"updatedAt":6067},"aggregation","perform data aggregation in TanStack Table","Aggregate TanStack Table columns independently of grouping, including grand totals, caller-selected row totals, multiple keyed aggregations, custom context-based definitions, grouped merges, manual values, and worker constraints.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[6060,6063,6064],{"name":6061,"slug":6062,"type":16},"Data Analysis","data-analysis",{"name":19,"slug":20,"type":16},{"name":10,"slug":9,"type":16},28175,"https:\u002F\u002Fgithub.com\u002FTanStack\u002Ftable","2026-07-30T05:25:59.429787",{"slug":6069,"name":6069,"fn":6070,"description":6071,"org":6072,"tags":6073,"stars":6065,"repoUrl":6066,"updatedAt":6079},"api-not-found","diagnose TanStack Table API errors","Diagnose missing TanStack Table v9 exports, options, state slices, and instance methods. Load before inventing an API when code sees a type error, undefined feature method, absent object key, adapter mismatch, or v8-shaped example.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[6074,6077,6078],{"name":6075,"slug":6076,"type":16},"Debugging","debugging",{"name":19,"slug":20,"type":16},{"name":10,"slug":9,"type":16},"2026-07-30T05:26:05.418735",{"slug":6081,"name":6081,"fn":6082,"description":6083,"org":6084,"tags":6085,"stars":6065,"repoUrl":6066,"updatedAt":6091},"cell-selection","select rectangular cell ranges in tables","Select rectangular cell ranges with cellSelectionFeature: two-corner range state keyed by row and column id, mousedown\u002Fmouseenter handlers, selection edges, render-order resolution under pinning, and autoResetCellSelection. Load when ranges widen unexpectedly after sorting or column reordering, when a drag re-renders the whole table, or when building copy-to-clipboard from a selection.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[6086,6087,6088],{"name":6061,"slug":6062,"type":16},{"name":10,"slug":9,"type":16},{"name":6089,"slug":6090,"type":16},"UI Components","ui-components","2026-07-30T05:25:38.403427",{"slug":6093,"name":6093,"fn":6094,"description":6095,"org":6096,"tags":6097,"stars":6065,"repoUrl":6066,"updatedAt":6106},"client-vs-server","manage TanStack Table data pipelines","Choose client or server ownership for filtering, grouping, sorting, expanding, and pagination in TanStack Table v9. Load for manual* flags, mixed pipelines, server counts, or deciding which dataset each row-model stage receives.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[6098,6101,6102,6105],{"name":6099,"slug":6100,"type":16},"Data Pipeline","data-pipeline",{"name":19,"slug":20,"type":16},{"name":6103,"slug":6104,"type":16},"Performance","performance",{"name":10,"slug":9,"type":16},"2026-07-30T05:25:45.400104",{"slug":6108,"name":6108,"fn":6109,"description":6110,"org":6111,"tags":6112,"stars":6065,"repoUrl":6066,"updatedAt":6118},"column-faceting","build faceted filter UIs","Build faceted filter UIs with columnFacetingFeature, facetedRowModel, facetedUniqueValues, and facetedMinMaxValues. Load for facet counts, numeric ranges, own-filter exclusion, or server-page facet completeness.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[6113,6116,6117],{"name":6114,"slug":6115,"type":16},"Data Visualization","data-visualization",{"name":19,"slug":20,"type":16},{"name":10,"slug":9,"type":16},"2026-07-30T05:25:41.397257",{"slug":6120,"name":6120,"fn":6121,"description":6122,"org":6123,"tags":6124,"stars":6065,"repoUrl":6066,"updatedAt":6128},"column-filtering","implement column filtering in TanStack Table","Filter columns with columnFilteringFeature, filteredRowModel, filterFns, filterMeta, nested-row direction, and manualFiltering. Load for accessor compatibility, controlled filter updaters, fuzzy metadata, or client\u002Fserver ownership.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[6125,6126,6127],{"name":6061,"slug":6062,"type":16},{"name":19,"slug":20,"type":16},{"name":10,"slug":9,"type":16},"2026-07-30T05:25:53.391632",{"slug":6130,"name":6130,"fn":6131,"description":6132,"org":6133,"tags":6134,"stars":6065,"repoUrl":6066,"updatedAt":6138},"column-ordering","manage TanStack Table column ordering","Control TanStack Table v9 leaf columnOrder with stable IDs while accounting for pinning regions, visibility, and groupedColumnMode precedence. Load for drag-and-drop columns or rendered order that differs from state.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[6135,6136,6137],{"name":19,"slug":20,"type":16},{"name":10,"slug":9,"type":16},{"name":6089,"slug":6090,"type":16},"2026-07-30T05:26:03.37801",{"slug":6140,"name":6140,"fn":6141,"description":6142,"org":6143,"tags":6144,"stars":6065,"repoUrl":6066,"updatedAt":6151},"column-pinning","configure column pinning in TanStack Table","Pin columns into logical start, center, and end regions with columnPinningFeature and renderer-owned sticky CSS. Load for RTL offsets, z-index, backgrounds, overflow, widths, gaps, or overlaps.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[6145,6148,6149,6150],{"name":6146,"slug":6147,"type":16},"CSS","css",{"name":19,"slug":20,"type":16},{"name":10,"slug":9,"type":16},{"name":6089,"slug":6090,"type":16},"2026-07-30T05:25:55.377366",{"slug":6153,"name":6153,"fn":6154,"description":6155,"org":6156,"tags":6157,"stars":6065,"repoUrl":6066,"updatedAt":6161},"column-resizing","implement column resizing in TanStack Table","Wire columnResizingFeature, header.getResizeHandler, resize mode and direction, pointer or touch events, and performant CSS-variable updates. Load when resize state changes but widths do not, or large tables resize slowly.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[6158,6159,6160],{"name":19,"slug":20,"type":16},{"name":10,"slug":9,"type":16},{"name":6089,"slug":6090,"type":16},"2026-07-30T05:25:51.400011",{"slug":6163,"name":6163,"fn":6164,"description":6165,"org":6166,"tags":6167,"stars":6065,"repoUrl":6066,"updatedAt":6172},"column-sizing","configure column sizing in TanStack Table","Use columnSizingFeature numeric size, minSize, maxSize, getSize, getStart, getAfter, and total-size APIs in table, grid, or flex CSS. Load for auto or percentage misconceptions and sizing\u002Fpinning layout mismatch.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[6168,6169,6170,6171],{"name":6146,"slug":6147,"type":16},{"name":19,"slug":20,"type":16},{"name":10,"slug":9,"type":16},{"name":6089,"slug":6090,"type":16},"2026-07-30T05:25:48.703799",{"slug":6174,"name":6174,"fn":6175,"description":6176,"org":6177,"tags":6178,"stars":6065,"repoUrl":6066,"updatedAt":6182},"column-visibility","manage column visibility in TanStack Table","Hide columns with columnVisibilityFeature while rendering visibility-aware header, column, and cell collections. Load when hidden columns remain in the DOM, false-versus-absent state is confused, or enableHiding is misunderstood.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[6179,6180,6181],{"name":19,"slug":20,"type":16},{"name":10,"slug":9,"type":16},{"name":6089,"slug":6090,"type":16},"2026-07-30T05:25:47.367943",{"slug":6184,"name":6184,"fn":6185,"description":6186,"org":6187,"tags":6188,"stars":6065,"repoUrl":6066,"updatedAt":6192},"core","build data grids with TanStack Table","Use TanStack Table v9 as a headless data-grid state and row-processing engine. Load for first-table architecture, stable data and columns, row numbering with getDisplayIndex, semantic rendering, framework adapter choice, or deciding what Table owns versus the renderer.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[6189,6190,6191],{"name":6061,"slug":6062,"type":16},{"name":19,"slug":20,"type":16},{"name":6089,"slug":6090,"type":16},"2026-07-30T05:25:52.366295",125]