Skip to content

Add DevTools extension#406

Draft
simolus3 wants to merge 3 commits intomainfrom
devtools-extension
Draft

Add DevTools extension#406
simolus3 wants to merge 3 commits intomainfrom
devtools-extension

Conversation

@simolus3
Copy link
Copy Markdown
Contributor

Flutter and Dart DevTools are a collection of debuggers and inspectors for Dart apps. Packages can contribute additional tools, and I think this could be interesting for PowerSync! This adds an extension to the powersync package. It currently has two pages which, provide these features:

Overview

grafik

This page shows the full path of the database (which may be convenient when path_provider is used and one wants to inspect a local database file), potential sync issues (a warning is shown for pending ps_crud rows and when the $local bucket is waiting for a checkpoint). This also exports the current token and endpoint passed to PowerSync, these values can be inspected and a deeplink can be used to open the same session in the full diagnostics app.

SQL console

grafik

This page is also inspired from the diagnostics app, it can be used to run queries against the live database in the app. There are buttons to help select from all tables in the schema (including raw tables).

How it works

Dart code can provide RPC entrypoints to invoke functions through the VM service protocol used by DevTools. Outside of release builds we do that to provide commands listing all opened PowerSync instances, to run queries or to post notifications on table and sync status changes.

In the DevTools extension, we use these RPC entrypoints to obtain a remote database instance we can use to run queries and to observe the sync status. This allows building the UI pages almost as if the PowerSync database was active in the extension itself.

There's a lot more potential here: We could also show buckets with download information through the new diagnostics protocol of the core extension. This is about as far as I could get in a hackday though, and I don't think it makese sense to invest much more time into it. We don't need this to overlap with the diagnostics app either, it's good enough to show obvious issues and can deeplink to diagnostics for anything more complex than that.

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.

1 participant