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 })
In my case, I want to organize messages by conversation, which means in internal query
getHistory, I need to change this:to this:
However, as
useStreamonly allow to pass thestreamId, I can't pass the activeconversationIdto the http route, thus I never get the chance to passconversationIdto internal querygetHistory.In order to provide more control to the developers, I suggest allow
useStreamto accept more arguments thanstreamIdonly. Maybe something like this: