Skip to content
Source
Sign inSign up
fuko/trytanstackdb.com

Add a temporary solution for handling conflicts between the remote state and client-side cache when moving todo items #37

Mergedfukomerged 4 commits intomain fromrefs/pull/37/headmerged by fuko View on GitHub

Showing 5 changed files with 60 additions and 129 deletions (loading 2).

x
0 of 5 viewed, 5 left
42 additions and 26 deletionssrc/collections/todoItems.tsModified
View file
@@ -35,26 +35,6 @@
return updatedItem;
​
-export async function batchUpdateTodoItem({
- data,
-}: {
- data: (Partial<TodoItemRecord> & { id: string })[];
-}) {
- const res = await fetch("/api/batch/todo-items", {
- method: "PATCH",
- headers: {
- "Content-Type": "application/json",
- },
- body: JSON.stringify(data),
- });
-​
- if (!res.ok) {
- throw new Error("Failed to batch update todo items");
- }
-​
- await res.json();
-}
-​
async function insertTodoItem({ data }: { data: TodoItemCreateDataType }) {
const res = await fetch("/api/todo-items", {