get-convex / get-convex/persistent-text-streaming

Support passing extra parameters

Open
#6 9 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
32
Forks
13
Avg merge
1h 41m
Merged PRs (30d)
1

Description

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

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

to this:

```ts
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:

```ts
useQuery(getBody, url, true, { streamId, ...rest })
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.