From c1f877cb8bf913426ea229fbb411bb37c93fd12b Mon Sep 17 00:00:00 2001 From: Simon Binder Date: Wed, 14 Oct 2026 10:43:48 +0200 Subject: [PATCH 1/2] Add more Rust snippets, remove outdated Tauri limitation --- client-sdks/frameworks/expo-go-support.mdx | 6 +- client-sdks/reference/tauri.mdx | 1 - client-sdks/usage-examples.mdx | 69 ++++++++++++++++++++-- 3 files changed, 67 insertions(+), 9 deletions(-) diff --git a/client-sdks/frameworks/expo-go-support.mdx b/client-sdks/frameworks/expo-go-support.mdx index c3639e538..00d297ca3 100644 --- a/client-sdks/frameworks/expo-go-support.mdx +++ b/client-sdks/frameworks/expo-go-support.mdx @@ -116,11 +116,9 @@ After adding PowerSync to your app: ## Data Persistence -Support for persistence with `@powersync/adapter-sql-js` is deprecated. The reason is that the implementation is inefficient, -doesn't provide consistency guarantees expected from SQLite, and writes are skipped as long as the database is connected. + Support for persistence with `@powersync/adapter-sql-js` is deprecated. The reason is that the implementation is inefficient, doesn't provide consistency guarantees expected from SQLite, and writes are skipped as long as the database is connected. -If you need persisted data across app restarts, use the [recommended setup](/client-sdks/reference/react-native-and-expo#installation) -with a local app build instead of Expo Go. + If you need persisted data across app restarts, use the [recommended setup](/client-sdks/reference/react-native-and-expo#installation) with a local app build instead of Expo Go. The default version of this adapter uses in-memory persistence, but you can specify your own `persister` option to the open factory. See an example in the package [README](https://www.npmjs.com/package/@powersync/adapter-sql-js). diff --git a/client-sdks/reference/tauri.mdx b/client-sdks/reference/tauri.mdx index ab81d9535..58e8490f7 100644 --- a/client-sdks/reference/tauri.mdx +++ b/client-sdks/reference/tauri.mdx @@ -332,7 +332,6 @@ Connection locks and table updates are automatically shared between Rust and Jav ## Limitations -- The Rust SDK, which is used to implement the Tauri plugin, does not provide `lastSyncedAt`, `hasSynced` and `priorityStatusEntries` on `SyncStatus`. Use the status on individual Sync Streams through `SyncStatus.forStream` instead. - Connecting to the PowerSync Service is only possible from Rust. Calling `connect()` from JavaScript will throw. ## Additional Usage Examples diff --git a/client-sdks/usage-examples.mdx b/client-sdks/usage-examples.mdx index fa48a2f22..ce926590e 100644 --- a/client-sdks/usage-examples.mdx +++ b/client-sdks/usage-examples.mdx @@ -219,7 +219,21 @@ import JavaScriptCallbackWatch from '/snippets/basic-watch-query-javascript-call Also see [`ReadTransaction`](https://powersync-ja.github.io/powersync-dotnet/api/PowerSync.Common.Client.PowerSyncDatabase.ReadTransaction.html). - Example not yet available. + ```rs + use powersync::{PowerSyncDatabase, error::PowerSyncError}; + use rusqlite::params; + + async fn delete_list(db: &PowerSyncDatabase, id: &str) -> Result<(), PowerSyncError> { + let mut writer = db.writer().await?; + let tx = writer.transaction()?; + + tx.execute("DELETE FROM lists WHERE id = ?", params![id])?; + tx.execute("DELETE FROM todos WHERE list_id = ?", params![id])?; + + tx.commit()?; + Ok(()) + } + ``` @@ -949,7 +963,22 @@ import JavaScriptCallbackWatch from '/snippets/basic-watch-query-javascript-call ``` - Example not yet available. + ```rs + use futures_lite::StreamExt; + use powersync::PowerSyncDatabase; + + async fn observe_status(db: &PowerSyncDatabase) { + let mut stream = db.watch_status(); + // watch_status() also returns the current snapshot when first polled, but status() can be used + // if access to the status is needed synchronously. + let mut status = db.status(); + + loop { + println!("PowerSync status: {status:?}"); + status = stream.next().await.unwrap(); + } + } + ``` @@ -1128,7 +1157,17 @@ import JavaScriptCallbackWatch from '/snippets/basic-watch-query-javascript-call ``` - Example not yet available. + ```rs + use futures_lite::StreamExt; + use powersync::PowerSyncDatabase; + + async fn wait_for_initial_sync(db: &PowerSyncDatabase) { + db.watch_status() + .filter(|status| status.has_synced()) + .next() + .await; + } + ``` @@ -1465,6 +1504,28 @@ import JavaScriptCallbackWatch from '/snippets/basic-watch-query-javascript-call - [Demo component](https://github.com/powersync-ja/powersync-dotnet/blob/main/demos/MAUITodo/Views/ListsPage.xaml.cs) - Example not yet available. + The Rust SDK doesn't report global sync progress, but can report progress for a Sync Stream. For an auto-subscribe Sync Stream named `lists`, progress can be tracked with: + + ```rs + use futures_lite::StreamExt; + use powersync::PowerSyncDatabase; + + async fn wait_for_initial_sync(db: &PowerSyncDatabase) { + let stream = db.sync_stream("lists", None); + let mut status = db.watch_status(); + while let Some(status) = status.next().await { + let progress = status + .for_stream(&stream) + .and_then(|stream| stream.progress); + + if let Some(progress) = progress { + println!( + "Stream progress: {} out of {}", + progress.downloaded, progress.total + ); + } + } + } + ``` From 39b0b973aa101d60885cf6307d366c40d6e0704b Mon Sep 17 00:00:00 2001 From: Simon Binder Date: Mon, 19 Oct 2026 16:40:53 +0200 Subject: [PATCH 2/2] AI feedback --- client-sdks/usage-examples.mdx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/client-sdks/usage-examples.mdx b/client-sdks/usage-examples.mdx index ce926590e..633e7798a 100644 --- a/client-sdks/usage-examples.mdx +++ b/client-sdks/usage-examples.mdx @@ -219,7 +219,7 @@ import JavaScriptCallbackWatch from '/snippets/basic-watch-query-javascript-call Also see [`ReadTransaction`](https://powersync-ja.github.io/powersync-dotnet/api/PowerSync.Common.Client.PowerSyncDatabase.ReadTransaction.html). - ```rs + ```Rust use powersync::{PowerSyncDatabase, error::PowerSyncError}; use rusqlite::params; @@ -963,7 +963,7 @@ import JavaScriptCallbackWatch from '/snippets/basic-watch-query-javascript-call ``` - ```rs + ```Rust use futures_lite::StreamExt; use powersync::PowerSyncDatabase; @@ -1157,7 +1157,7 @@ import JavaScriptCallbackWatch from '/snippets/basic-watch-query-javascript-call ``` - ```rs + ```Rust use futures_lite::StreamExt; use powersync::PowerSyncDatabase; @@ -1504,13 +1504,13 @@ import JavaScriptCallbackWatch from '/snippets/basic-watch-query-javascript-call - [Demo component](https://github.com/powersync-ja/powersync-dotnet/blob/main/demos/MAUITodo/Views/ListsPage.xaml.cs) - The Rust SDK doesn't report global sync progress, but can report progress for a Sync Stream. For an auto-subscribe Sync Stream named `lists`, progress can be tracked with: + The Rust SDK doesn't report global sync progress, but can report progress for a Sync Stream. For an auto-subscribe Sync Stream named `lists`, you can track progress with: - ```rs + ```Rust use futures_lite::StreamExt; use powersync::PowerSyncDatabase; - async fn wait_for_initial_sync(db: &PowerSyncDatabase) { + async fn print_progress(db: &PowerSyncDatabase) { let stream = db.sync_stream("lists", None); let mut status = db.watch_status(); while let Some(status) = status.next().await {