Closed HenriChabert closed 1 year ago
Hey, thanks for the issue.
Can you elaborate on the following?
sometimes, when refreshing the app, the watcher does not get deleted
What is sometimes? What does "watcher doesn't get deleted" mean exactly?
Hello,
Thanks for the answer. It basically means that calling a second time the function watchConversations
does not retrigger the watch function, as if the native iOS code already had the watch function stored and would only retrigger it when there are some changes in the conversation.
My usecase it that I need to get the conversations of a user to display the right one inside one of my view (There should only be one conversation per user).
Thanks!
Calling 2 times watchConversations
in a row will indeed lead to this behavior, this is a limitation of the event system of react native, but given your use case that's not something that should happen.
Why would you call it twice?
I would prefer not calling it twice, but when user is logging out and logging in in the app, or when the app gets reloaded, although I try to remove the watcher, it sometimes fails being deleted.
Thus, when accessing to the page showing Nabla conversation, I have no way to get the conversation ID to display if the watcher was not deleted leaving it before. Does it make sense?
I already store the conversation ID in the async storage but still, I would just need to get the user's conversations. With that said, I can also use Nabla Server API to get this information, but if I were able to get it with nablaMessagingClient.getConversations
, that would be great.
Can you elaborate on the following?
although I try to remove the watcher, it sometimes fails being deleted.
What does "sometimes" mean? What does failing mean?
Hello @benoitletondor, I reviewed my structure and the lifecycle of my app, it works a lot better, I think I was handling the watcher wrongly. Thanks!
Ok let me know if you need any help or if you think our documentation can be clearer. Thanks again.
Hello team,
I am trying to get the conversations of a user with the function
watchConversations
. It works most of the time, but sometimes, when refreshing the app, the watcher does not get deleted. In that case, re-usingwatchConversations
does not return anything as the watcher already exists somewhere but I cannot retrieve it and there are no way of resetting it.Would it be possible to have either a function
getConversations
that returns the conversations of the loggedin user, and that does not rely on a watcher, or a way to clean current watcher to reinistanciate one?Thanks!