Skip to content

Commit 1818220

Browse files
committed
Restore demo
1 parent e365c6f commit 1818220

File tree

4 files changed

+3
-35
lines changed

4 files changed

+3
-35
lines changed

demos/react-supabase-todolist/.env.local.template

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@
33
VITE_SUPABASE_URL=https://foo.supabase.co
44
VITE_SUPABASE_ANON_KEY=foo
55
VITE_POWERSYNC_URL=https://foo.powersync.journeyapps.com
6-
VITE_USE_SYNC_STREAMS=false

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

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ import {
1919
} from '@mui/material';
2020
import Fab from '@mui/material/Fab';
2121
import { usePowerSync, useQuery } from '@powersync/react';
22-
import { SyncStreamSubscription } from '@powersync/web';
23-
import React, { Suspense, useEffect } from 'react';
22+
import React, { Suspense } from 'react';
2423
import { useParams } from 'react-router-dom';
2524

2625
/**
@@ -33,29 +32,6 @@ const TodoEditSection = () => {
3332
const supabase = useSupabase();
3433
const { id: listID } = useParams();
3534

36-
if (import.meta.env.VITE_USE_SYNC_STREAMS == 'true') {
37-
useEffect(() => {
38-
let active = true;
39-
let subscription: SyncStreamSubscription | null = null;
40-
41-
powerSync
42-
.syncStream('todos', { list: listID })
43-
.subscribe()
44-
.then((sub) => {
45-
if (!active) {
46-
sub.unsubscribe();
47-
} else {
48-
subscription = sub;
49-
}
50-
});
51-
52-
return () => {
53-
active = false;
54-
subscription?.unsubscribe();
55-
};
56-
}, [listID]);
57-
}
58-
5935
const {
6036
data: [listRecord]
6137
} = useQuery<{ name: string }>(

demos/react-supabase-todolist/src/components/providers/SystemProvider.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,7 @@ import { AppSchema, ListRecord, LISTS_TABLE, TODOS_TABLE } from '@/library/power
33
import { SupabaseConnector } from '@/library/powersync/SupabaseConnector';
44
import { CircularProgress } from '@mui/material';
55
import { PowerSyncContext } from '@powersync/react';
6-
import {
7-
createBaseLogger,
8-
DifferentialWatchedQuery,
9-
LogLevel,
10-
PowerSyncDatabase,
11-
SyncClientImplementation
12-
} from '@powersync/web';
6+
import { createBaseLogger, DifferentialWatchedQuery, LogLevel, PowerSyncDatabase } from '@powersync/web';
137
import React, { Suspense } from 'react';
148
import { NavigationPanelContextProvider } from '../navigation/NavigationPanelContext';
159

@@ -74,7 +68,7 @@ export const SystemProvider = ({ children }: { children: React.ReactNode }) => {
7468
const l = connector.registerListener({
7569
initialized: () => {},
7670
sessionStarted: () => {
77-
powerSync.connect(connector, { clientImplementation: SyncClientImplementation.RUST });
71+
powerSync.connect(connector);
7872
}
7973
});
8074

demos/react-supabase-todolist/src/library/powersync/vite-env.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ interface ImportMetaEnv {
44
readonly VITE_SUPABASE_URL: string;
55
readonly VITE_SUPABASE_ANON_KEY: string;
66
readonly VITE_POWERSYNC_URL: string;
7-
readonly VITE_USE_SYNC_STREAMS: string;
87
}
98

109
interface ImportMeta {

0 commit comments

Comments
 (0)