Skip to content

Allow providing a function string | LiveQuery<T> with useLiveQuery#503

Draft
SandroMaglione wants to merge 2 commits intoelectric-sql:mainfrom
SandroMaglione:sandro/live-query-from-results
Draft

Allow providing a function string | LiveQuery<T> with useLiveQuery#503
SandroMaglione wants to merge 2 commits intoelectric-sql:mainfrom
SandroMaglione:sandro/live-query-from-results

Conversation

@SandroMaglione
Copy link
Contributor

@SandroMaglione SandroMaglione commented Jan 16, 2025

As discussed inside Discord, this PR adds a new accepted signature to useLiveQuery as follows:

export function useLiveQuery<T = { [key: string]: unknown }>(
  liveQueryPromise: () => Promise<string | LiveQuery<T>>,
): LiveQueryResults<T> | undefined

This allows to provide a function returning a query string or a generic LiveQuery to useLiveQuery.

@samwillis I am having some type issues that prevents me from testing the implementation

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

Comments