Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refresh schema UI as live share queries executed #118

Merged
merged 1 commit into from
Oct 30, 2024

Conversation

gregnr
Copy link
Collaborator

@gregnr gregnr commented Oct 29, 2024

Monitors wire protocol messages during a Live Share session and automatically updates the schema UI to reflect the current state.

Background

In order to update the schema UI, we need to query the PGlite instance (via pg-meta) to get the latest tables/columns. Since this requires executing SQL against the same PGlite instance that Live Share is communicating with, we need to be careful not to run this when the user is in the middle of set of protocol messages (eg. extended queries).

When is it safe?

We update the UI after detecting a ReadyForQuery response from PGlite, which indicates that the current set of protocol messages have completed and a fresh query is safe to execute. We also ensure that the connection is not in the middle of a transaction by checking a transaction status flag sent with the ReadyForQuery message.

Copy link

vercel bot commented Oct 29, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
postgres-new ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 29, 2024 8:49pm

Copy link
Contributor

@jgoux jgoux left a comment

Choose a reason for hiding this comment

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

Nice! 🚀

apps/postgres-new/components/app-provider.tsx Show resolved Hide resolved
@gregnr gregnr merged commit f1dcb5c into main Oct 30, 2024
2 checks passed
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