Closed tonyhart7 closed 1 year ago
I'm not sure that I understand your use case but I don't think you can yield
to the parent context from within the subscribe callback even if the function was async*
.
You can try to create your own stream and push data to it via the subscribe
callback.
Then inside the riverpod function you can use the await for
(not .listen(...)
) construct with your stream and yield within its block.
I'm not sure that I understand your use case but I don't think you can
yield
to the parent context from within the subscribe callback even if the function wasasync*
.You can try to create your own stream and push data to it via the
subscribe
callback. Then inside the riverpod function you can use theawait for
(not.listen(...)
) construct with your stream and yield within its block.
Okay its works, but how to query old data tho ??
like I want to aquire existing data if there are some but as long as new data get inserted. it gets automatically added
Okay its works, but how to query old data tho ??
PocketBase realtime events reacts only on changes (aka. create/update/delete of a record).
If you want to fetch the already inserted data you'll have to query it manually with the regular getList()
/getFullList()
methods.
By the way, you can also check the StateProvider
which might be better for your use case since you'll not need the extra stream.
In any case, I'll close the issue for now but feel free to comment if you stumble on something else.
I am using riverpod with StreamProvider and want to use yield when new record created but I cant do that because RecordSubscriptionEven output Void at the end