Skip to content

Tauri: Use numeric event identifiers for databases#957

Merged
simolus3 merged 1 commit into
mainfrom
tauri-event-ids
May 14, 2026
Merged

Tauri: Use numeric event identifiers for databases#957
simolus3 merged 1 commit into
mainfrom
tauri-event-ids

Conversation

@simolus3
Copy link
Copy Markdown
Contributor

As @msvargas pointed out in #956, Tauri doesn't allow arbitrary characters in event names.

Currently, we encode the path of databases into event keys to allow JavaScript clients to listen to changed tables and the sync status. This was mostly me being lazy, using opaque identifiers for databases to generate events is probably a better approach than relying on paths (even when mangled). So, this has Rust assign an incrementing integer to created databases which is then used for events. We inform JavaScript about the id when a database is opened, allowing it to register event listeners.

This is covered by existing tests (stream subscriptions and watch smoke test).

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 13, 2026

🦋 Changeset detected

Latest commit: 5910e31

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

This PR includes changesets to release 2 packages
Name Type
tauri-plugin-powersync Patch
@powersync/tauri-plugin 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 marked this pull request as ready for review May 13, 2026 07:38
@simolus3 simolus3 requested a review from stevensJourney May 13, 2026 07:38
Co-authored-by: msvargas <msvargas97@gmail.com>
@simolus3 simolus3 merged commit ac03209 into main May 14, 2026
15 checks passed
@simolus3 simolus3 deleted the tauri-event-ids branch May 14, 2026 10:15
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