Skip to content

Commit 8e4d572

Browse files
Cleanup demo
1 parent bd8214b commit 8e4d572

File tree

7 files changed

+26
-8
lines changed

7 files changed

+26
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Demo applications are located in the [`demos/`](./demos/) directory. Also see ou
6767
### Web
6868

6969
- [demos/react-supabase-todolist](./demos/react-supabase-todolist/README.md): A React to-do list example app using the PowerSync Web SDK and a Supabase backend.
70-
- [demos/react-supabase-todolist-tanstackdb](./demos/react-supabase-todolist-tanstackdb/README.md): A React to-do list example app using the PowerSync Web SDK and a Supabase backend + TanStackDB collections.
70+
- [demos/react-supabase-todolist-tanstackdb](./demos/react-supabase-todolist-tanstackdb/README.md): A React to-do list example app using the PowerSync Web SDK and a Supabase backend + [TanStackDB](https://tanstack.com/db/latest) collections.
7171
- [demos/react-multi-client](./demos/react-multi-client/README.md): A React widget that illustrates how data flows from one PowerSync client to another.
7272
- [demos/yjs-react-supabase-text-collab](./demos/yjs-react-supabase-text-collab/README.md): A React real-time text editing collaboration example app powered by [Yjs](https://github.com/yjs/yjs) CRDTs and [Tiptap](https://tiptap.dev/), using the PowerSync Web SDK and a Supabase backend.
7373
- [demos/vue-supabase-todolist](./demos/vue-supabase-todolist/README.md): A Vue to-do list example app using the PowerSync Web SDK and a Supabase backend.

demos/react-supabase-todolist-tanstackdb/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Overview
44

5-
Demo app demonstrating use of the [PowerSync SDK for Web](https://www.npmjs.com/package/@powersync/web) together with Supabase and the PowerSync TanStackDB integration.
5+
Demo app demonstrating use of the [PowerSync SDK for Web](https://www.npmjs.com/package/@powersync/web) together with Supabase and the PowerSync [TanStackDB](https://tanstack.com/db/latest) integration.
66

77
A step-by-step guide on Supabase<>PowerSync integration is available [here](https://docs.powersync.com/integration-guides/supabase-+-powersync).
88

demos/react-supabase-todolist-tanstackdb/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "react-supabase-todolist",
2+
"name": "react-supabase-todolist-tanstackdb",
33
"version": "0.0.1",
44
"private": true,
55
"scripts": {

demos/react-supabase-todolist-tanstackdb/src/app/views/sql-console/page.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ const TableDisplay = React.memo(({ data }: { data: ReadonlyArray<any> }) => {
5050
);
5151
});
5252

53+
/**
54+
* The page here is as it's named. A SQL console for debug purposes.
55+
* We provide SQL access to the PowerSync database.
56+
* We cannot use TanStack collections for this page.
57+
*/
5358
export default function SQLConsolePage() {
5459
const inputRef = React.useRef<HTMLInputElement>();
5560
const [query, setQuery] = React.useState(DEFAULT_QUERY);

demos/react-supabase-todolist-tanstackdb/src/app/views/todo-lists/edit/page.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@ import { eq, useLiveQuery } from '@tanstack/react-db';
2121
import React, { Suspense } from 'react';
2222
import { useParams } from 'react-router-dom';
2323

24-
/**
25-
* useSearchParams causes the entire element to fall back to client side rendering
26-
* This is exposed as a separate React component in order to suspend its render
27-
* and allow the root page to render on the server.
28-
*/
2924
const TodoEditSection = () => {
3025
const supabase = useSupabase();
3126
const { id: listID } = useParams();

demos/react-supabase-todolist-tanstackdb/src/library/powersync/ListsSchema.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ import { column, Table } from '@powersync/web';
22
import { z } from 'zod';
33
import { stringToDate } from './zod-helpers';
44

5+
/**
6+
* The PowerSync schema for the todos table.
7+
*/
58
export const LISTS_TABLE_DEFINITION = new Table({
69
created_at: column.text,
710
name: column.text,
@@ -10,6 +13,7 @@ export const LISTS_TABLE_DEFINITION = new Table({
1013

1114
/**
1215
* Extends the PowerSync schema with required fields and boolean/Date transforms.
16+
* This requires stricter validations for inputs (used for insert, update, etc.)
1317
*/
1418
export const ListsSchema = z.object({
1519
id: z.string(),
@@ -18,6 +22,11 @@ export const ListsSchema = z.object({
1822
owner_id: z.string()
1923
});
2024

25+
/**
26+
* We're using an input type which is different from the SQLite table type.
27+
* We require this schema in order to deserialize incoming data from the database.
28+
* This is not required if SQLite types are used as the input type.
29+
*/
2130
export const ListsDeserializationSchema = z.object({
2231
...ListsSchema.shape,
2332
created_at: stringToDate

demos/react-supabase-todolist-tanstackdb/src/library/powersync/TodosSchema.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ import { column, Table } from '@powersync/web';
22
import { z } from 'zod';
33
import { nullableStringToDate, numberToBoolean, stringToDate } from './zod-helpers';
44

5+
/**
6+
* The PowerSync schema for the todos table.
7+
*/
58
export const TODOS_TABLE_DEFINITION = new Table(
69
{
710
list_id: column.text,
@@ -17,6 +20,7 @@ export const TODOS_TABLE_DEFINITION = new Table(
1720

1821
/**
1922
* Extends the PowerSync schema with required fields and boolean/Date transforms.
23+
* This requires stricter validations for inputs (used for insert, update, etc.)
2024
*/
2125
export const TodosSchema = z.object({
2226
id: z.string(),
@@ -29,6 +33,11 @@ export const TodosSchema = z.object({
2933
completed: z.boolean()
3034
});
3135

36+
/**
37+
* We're using an input type which is different from the SQLite table type.
38+
* We require this schema in order to deserialize incoming data from the database.
39+
* This is not required if SQLite types are used as the input type.
40+
*/
3241
export const TodosDeserializationSchema = z.object({
3342
...TodosSchema.shape,
3443
created_at: stringToDate,

0 commit comments

Comments
 (0)