Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
powersyncpackage. It currently has two pages which, provide these features:Overview
This page shows the full path of the database (which may be convenient when
path_provideris used and one wants to inspect a local database file), potential sync issues (a warning is shown for pendingps_crudrows and when the$localbucket 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
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.