electric-sql / pglite

Lightweight WASM Postgres with real-time, reactive bindings.
https://pglite.dev
Apache License 2.0
9.49k stars 204 forks source link

fix(pglite/live): Fix querying views, and extend the return value to allow late attachment of a callback #374

Closed samwillis closed 1 month ago

samwillis commented 1 month ago

This fixes live queries when they are querying a view rather than a table. It now recursively introspects the dependencies of the query to find all tables it depends on.

It also extends the live query return values to allow subscribing with a callback after creating the live query. This enables crating a live query in a React router loader, then passing it to a view to use with useLiveQuery.

See also #375

github-actions[bot] commented 1 month ago

Built bundles:

github-actions[bot] commented 1 month ago

🚀 Deployed on https://670d20ae2ae625f26a5c8718--pglite.netlify.app