Skip to content

Support passing extra parameters #6

@nightire

Description

@nightire

In my case, I want to organize messages by conversation, which means in internal query getHistory, I need to change this:

const allMessages = await context.db.query("messages").collect()

to this:

const allMessages = await context.db
  .query("messages")
  .withIndex("by_conversation", (q) => q.eq("conversationId", conversationId))
  .collect()

However, as useStream only allow to pass the streamId, I can't pass the active conversationId to the http route, thus I never get the chance to pass conversationId to internal query getHistory.

In order to provide more control to the developers, I suggest allow useStream to accept more arguments than streamId only. Maybe something like this:

useQuery<RestArguments>(getBody, url, true, { streamId, ...rest })

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions