Skip to content
This repository was archived by the owner on Feb 9, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ yarn-error.*
# macOS
.DS_Store
*.pem

# local env files
.env*.local
.env

# typescript
*.tsbuildinfo
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# PowerSync + Supabase React Native Demo: Todo List

## Note: Alpha Release
## Note: Beta Release

This package is currently in an alpha release. Functionality could change dramatically in future releases. Certain functions may be partially implemented or buggy.
This package is currently in a beta release.

## Overview

Expand Down Expand Up @@ -45,7 +45,7 @@ It does the following:

## Set up PowerSync Instance

Create a new PowerSync instance, connecting to the database of the Supabase project.
Create a new PowerSync instance, connecting to the database of the Supabase project (find detailed instructions in the [Supabase<>PowerSync integration guide](https://docs.powersync.co/integration-guides/supabase)).

Then deploy the following sync rules:

Expand Down
3 changes: 1 addition & 2 deletions app/signin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { TextInputWidget } from '../library/widgets/TextInputWidget';
import { Icon } from 'react-native-elements';

export default function Signin() {
const { supabaseConnector, attachmentQueue } = useSystem();
const { supabaseConnector } = useSystem();
const [loading, setLoading] = React.useState(false);
const [credentials, setCredentials] = React.useState({ username: '', password: '' });
const [error, setError] = React.useState('');
Expand Down Expand Up @@ -43,7 +43,6 @@ export default function Signin() {
setError('');
try {
await supabaseConnector.login(credentials.username, credentials.password);
await attachmentQueue.clearQueue();
router.replace('views/todos/lists');
} catch (ex: any) {
console.error(ex);
Expand Down
13 changes: 3 additions & 10 deletions app/views/todos/edit/[id].tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ATTACHMENT_TABLE, AttachmentRecord } from '@journeyapps/powersync-attachments';
import { usePowerSync, usePowerSyncWatchedQuery } from '@journeyapps/powersync-sdk-react-native';
import { CameraCapturedPicture } from 'expo-camera';
import _ from 'lodash';
Expand All @@ -7,13 +8,7 @@ import { ScrollView, View, Text } from 'react-native';
import { FAB } from 'react-native-elements';
import { Stack, useLocalSearchParams } from 'expo-router';
import prompt from 'react-native-prompt-android';
import {
ATTACHMENT_TABLE,
AttachmentRecord,
TODO_TABLE,
TodoRecord,
LIST_TABLE
} from '../../../../library/powersync/AppSchema';
import { TODO_TABLE, TodoRecord, LIST_TABLE } from '../../../../library/powersync/AppSchema';
import { useSystem } from '../../../../library/powersync/system';
import { TodoItemWidget } from '../../../../library/widgets/TodoItemWidget';

Expand Down Expand Up @@ -58,9 +53,7 @@ const TodoView: React.FC = () => {
${ATTACHMENT_TABLE} ON ${TODO_TABLE}.photo_id = ${ATTACHMENT_TABLE}.id
WHERE
${TODO_TABLE}.list_id = ?`,
[listID],
// NOTE: It is important to add the tables to the watch list, otherwise the query will not be re-executed
{ tables: [TODO_TABLE, ATTACHMENT_TABLE, LIST_TABLE] }
[listID]
);

const toggleCompletion = async (record: TodoRecord, completed: boolean) => {
Expand Down
Loading