The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
updated example todo
awalias9497ffc69597
diff --git a/examples/todo/src/Store.js b/examples/todo/src/Store.jsindex 92ee0121cb7..c71b6de0214 100644--- a/examples/todo/src/Store.js+++ b/examples/todo/src/Store.js@@ -16,10 +16,10 @@ export const useStore = (props) => {fetchList(props.uuid).then((response) => {setList(response)- setTasks(response.tasks.sort((a, b) => a.id - b.id))+ setTasks(response.tasks.sort((a, b) => b.id - a.id))}).catch(console.error)- }, [])+ }, [props.uuid])useEffect(() => {const handleAsync = async () => {@@ -29,12 +29,15 @@ export const useStore = (props) => {if (task.id === newTask.id) {tasks[i] = newTaskreturn true+ } else {+ return false}})if (update) {- setTasks([...tasks]) // update+ setTasks(t => [...tasks]) // update} else {- setTasks(tasks.concat(newTask)) // new+ tasks.unshift(newTask)+ setTasks(t => [...tasks]) // new}}}@@ -51,7 +54,7 @@ export const useStore = (props) => {.subscribe())}- }, [list])+ }, [list, taskListener])return { list, tasks, setTasks }}diff --git a/examples/todo/src/TodoList.js b/examples/todo/src/TodoList.jsindex d49fce60adc..91ab17c8c6b 100644--- a/examples/todo/src/TodoList.js+++ b/examples/todo/src/TodoList.js@@ -12,7 +12,7 @@ export const TodoList = (uuid) => {<h1 className="section">My Task List</h1><div className="section"><label>Sharing url: </label>- <input type="text" readonly value={window.location.href} />+ <input type="text" readOnly value={window.location.href} /></div><div className={'field-row section'}><form@@ -27,7 +27,7 @@ export const TodoList = (uuid) => {value={newTaskText}onChange={(e) => setNewTaskText(e.target.value)}/>- <button type="submit" onClick={() => addTask(newTaskText, list.id)}>+ <button type="submit" onClick={() => (newTaskText ? addTask(newTaskText, list.id) : '')}>add task</button></form>@@ -44,6 +44,8 @@ export const TodoList = (uuid) => {if (t.id === task.id) {tasks[i].complete = !task.completereturn true+ } else {+ return false}})setTasks([...tasks])@@ -61,7 +63,9 @@ export const TodoList = (uuid) => {: ''}</div><div className="section">- <small>warning: do not store any sensitive information in this list, it is not secure</small>+ <small>+ warning: do not store any sensitive information in this list, it is not secure+ </small></div></div>)