Skip to content

Tauri: Bind boolean parameters as integers - #1143

Merged
simolus3 merged 3 commits into
powersync-ja:mainfrom
LashaKamadadze:tauri-bind-booleans
Oct 8, 2026
Merged

simolus3 merged 3 commits into
powersync-ja:mainfrom
LashaKamadadze:tauri-bind-booleans

Conversation

@LashaKamadadze

Copy link
Copy Markdown
Contributor

Binding a JavaScript boolean as a query parameter currently fails with the Tauri plugin, because the SqliteValue deserializer in commands.rs has no visit_bool. The same call works with @powersync/web: wa-sqlite binds true/false as 1/0 (sqlite-api.js). SQLite has no boolean type, so 1/0 is the usual representation.

We ran into this when moving a production desktop app from @powersync/web to @powersync/tauri-plugin (WebKitGTK's WASM memory growth made the web SDK unusable for us on Linux). Queries that bound booleans started failing after the switch, and we've been running with this change in a local copy of the plugin since.

This PR:

  • Adds visit_bool to the SqliteValue deserializer, mapping true/false to SqliteValue::Integer(1)/SqliteValue::Integer(0), the same way Tauri: Fix binding integer values, emit events on main thread #965 handled integers parsed as u64. The expecting message now lists booleans too.
  • Adds a can bind booleans integration test next to can bind integers.
  • Adds a changeset for @powersync/tauri-plugin.

A second, separate commit fixes three clippy lints in commands.rs (redundant_pattern_matching, explicit_auto_deref) so cargo clippy --all-targets -- -D warnings passes. It doesn't change behavior; happy to drop it if you'd rather keep this PR to the fix.

Testing: cargo fmt --check, cargo clippy --all-targets -- -D warnings and cargo test pass for packages/tauri. I haven't run the Tauri integration suite (pnpm test with the test runner) locally, and that step is currently disabled in CI, so the new test hasn't been executed yet.

Side note, not changed here: packages/tauri/Cargo.toml uses rust = "1.77", which Cargo ignores with an "unused manifest key" warning. The key Cargo reads is rust-version.

SQLite has no boolean type. The web SDK (wa-sqlite) binds true/false as
1/0, but the Tauri plugin rejected boolean parameters, so queries that
work with @powersync/web fail after switching to @powersync/tauri-plugin.

Add visit_bool to the SqliteValue deserializer, a test mirroring
'can bind integers', and a changeset.
redundant_pattern_matching and explicit_auto_deref; no behavior change.
@changeset-bot

changeset-bot Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 81c58a5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
tauri-plugin-powersync Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@simolus3 simolus3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix!

Comment thread .changeset/tauri-bind-booleans.md Outdated
Co-authored-by: Simon Binder <oss@simonbinder.eu>

@simolus3 simolus3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I also ran tests locally.

@simolus3
simolus3 merged commit 6f14426 into powersync-ja:main Oct 8, 2026
6 checks passed
@LashaKamadadze
LashaKamadadze deleted the tauri-bind-booleans branch October 9, 2026 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants