Skip to content

Commit f10aecd

Browse files
committed
Attachments docs: Point to uses in example
1 parent 0252b30 commit f10aecd

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

demos/supabase-todolist/lib/attachments/queue.dart

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,3 @@ Future<Attachment> savePhotoAttachment(
5353
},
5454
);
5555
}
56-
57-
Future<Attachment> deletePhotoAttachment(String fileId) async {
58-
return await attachmentQueue.deleteFile(
59-
attachmentId: fileId,
60-
updateHook: (context, attachment) async {
61-
// Optionally update relationships in the same transaction
62-
},
63-
);
64-
}

packages/powersync_core/doc/attachments.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ The attachments' state is stored in a local-only attachments table.
4343

4444
See the [supabase-todolist](https://github.com/powersync-ja/powersync.dart/tree/main/demos/supabase-todolist) demo for a basic example of attachment syncing.
4545

46+
In particular, relevant snippets from that example are:
47+
48+
- The attachment queue is set up [here](https://github.com/powersync-ja/powersync.dart/blob/98d73e2f157a697786373fef755576505abc74a5/demos/supabase-todolist/lib/attachments/queue.dart#L16-L36), using conditional imports to store attachments in the file system on native platforms and in-memory for web.
49+
- When a new attachment is added, `saveFile` is called [here](https://github.com/powersync-ja/powersync.dart/blob/98d73e2f157a697786373fef755576505abc74a5/demos/supabase-todolist/lib/attachments/queue.dart#L38-L55) and automatically updates references in the main schema to reference the attachment.
50+
4651
### Setup
4752

4853
First, add a table storing local attachment state to your database schema.

0 commit comments

Comments
 (0)