Skip to content
Discussion options

You must be logged in to vote

Late to the party, but you can return early in your second query (in case you still need a solution):

export function useGroupOrderSummary({ userId }: { userId?: string }) {
  return useLiveQuery(
    (q) =>
      userId ?
          q
            .from({ gos: groupOrderSummaryCollection(userId) })
            .where(({ gos }) => or(eq(gos.fromId, userId), eq(gos.toId, userId)))
        : undefined
    [userId],
  );
}

Beware, there is currently a pending PR that fixes isReady from being stuck with a false value when returning early: #886

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@TimFL
Comment options

Answer selected by mnpqraven
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants