-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding support for events #63
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love the initiative! 💖
cc @judofyr and @rexxars to get their insight on this.
I'm wondering if we could solve this use case by adding an adapter API for how datasets load. It would give us more options when setting up experiences like preview-kit when there's a very large amount of documents in your dataset, and includeTypes
is insufficient to stay below the documentLimit
.
Another interesting use case is hosting your own EventSource instance. Doing so allows custom authentication schemes and self-hosting frees you from our Listeners limits.
eventEmitter.emit('datasetChanged', { | ||
dataset: config.dataset, | ||
documents: docs, | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this emitter should be throttled, the same way executeAllSubscriptions
is.
To avoid a mismatch where you will see datasetChanged
events fire, but store.query
and such not yet "see" the changes yet since these are throttled.
* Emitted after the dataset was loaded. | ||
*/ | ||
datasetLoaded: { | ||
dataset: string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the purpose of this field? It seems a bit artificial to have dataset
(and not projectId
) here. And whenever you set up the listener you probably already know which dataset
/projectId
it's applied to?
Interesting! Some quick thoughts:
|
I'm using groq-store in a Node server and I'm wondering whether I can get some additional useful information out of that.
What I'm thinking is really basic, like "dataset was loaded with X documents", and a similar update whenever changes are received through the listener API.
My first idea was to support some eventing, like
store.on('datasetChanged', () => {...})
, so I gave it a go and tried to implement it.Let me know what you think :)