Skip to content

Accept query options in live queries and React hooks - #1080

Open
psh4607 wants to merge 2 commits into
electric-sql:mainfrom
psh4607:feat/live-query-options
Open

Accept query options in live queries and React hooks#1080
psh4607 wants to merge 2 commits into
electric-sql:mainfrom
psh4607:feat/live-query-options

Conversation

@psh4607

@psh4607 psh4607 commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

작업 배경

useLiveQuery did not expose PGlite query options, preventing callers from requesting result formats such as rowMode: 'array'. The live-query core API also needed to accept the same options so React could forward them consistently.

티켓 및 링크

작업 내용

  • Add QueryOptions support to positional and object forms of live.query while preserving the existing positional callback API.
  • Forward query options from React's useLiveQuery and stabilize inline option objects to avoid unnecessary resubscriptions.
  • Apply result options consistently to initial results and subsequent live updates while keeping metadata queries on object rows.
  • Support parameter types and custom serializers during live-query formatting without double serialization.
  • Add runtime, React, and public type coverage plus patch changesets for PGlite and PGlite React.
  • Keep incremental live queries out of scope because their update/merge path requires separate handling.

테스트

  • pnpm --filter @electric-sql/pglite build
  • pnpm -C packages/pglite exec vitest run tests/live.test.ts (48 passed)
  • pnpm --filter @electric-sql/pglite typecheck
  • pnpm --filter @electric-sql/pglite stylecheck
  • pnpm -C packages/pglite-react exec vitest run test/hooks-options.test.tsx (1 passed)
  • pnpm --filter @electric-sql/pglite-react typecheck
  • pnpm --filter @electric-sql/pglite-react stylecheck
  • pnpm --filter @electric-sql/pglite-react build

@psh4607
psh4607 marked this pull request as ready for review August 13, 2026 02:48
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.

Feature request: accept QueryOptions for useLiveQuery hook

1 participant