Closed bdbch closed 4 years ago
Hi
If your response is the same or similar to your variables offix will generate it out of the box. There is no need to pass update function and optimistic response. For more info check our docs: https://offix.dev/docs/offix-cache
However if your case requires custom update and optimistic response I will look for the issue in sendMessageResponse
that is missing in snippet. We should see this method called twice - once with your optimistic response and once with actual data.
For custom optimistic response and update method please check this chat app build with old version of offix:
Thanks! I'll look into that and report back if that helped me solving my issue.
You were right, I had a problem in my sendMessageUpdate
function. It works again. As I can see offix does not cache the update functions between app sessions so when I restart the app while offline, the update functions are gone right?
https://offix.dev/docs/offline-client#global-update-functions
The documentation here isn't really clear. Do you have an good example on how those global update functions should look like? I'm trying to keep my sent offline messages when the app is restarted but I can't get it working.
@bdbch glad to hear you got to the bottom of that problem. With regards to the restoring optimistic responses problems. We had another user create an issue on the same topic and I left some tips there. Can you check my comments in https://github.com/aerogear/offix/issues/340 and see if there are helpful in any way?
We need this as part of the sample app and copy-paste your comment to the docs. I fully agree that our docs in that area are very unclear.
Thanks! I'll take a look into your tips @darahayes.
@wtrocki is the documentation on github as well?
We have documentation on the website http://offix.dev Source code for that documentation can be found here: https://github.com/aerogear/offix/tree/master/docs
We are happy to accept contributions
If I understand the concept I'll look into contributing a demo to the docs!
I was able to resolve this issue here: https://github.com/aerogear/offix/issues/340
Bug Report
Hey, awesome project! I used a custom written wrapper for our offline support before but switching to a maintained project is way better.
I implemented offix in our messaging app and everything seems to work fine but I can't get our optimistic response to work. The problem is that everytime I try to send a message into a chat while I'm offline it does not generate the optimistic UI for the message so you have to wait until the client gets back online to see the optimistic UI for a second and then you see the actual message responded by the server.
Am I missing something or doing something wrong? This is how we send the mutation:
the optimistic response itself is self generated but just looks fine (and it's working when I'm online).
Do I have to do something to actually get the optimistic UI while offline?
Affected Package(s):
offix
Package version(s):
0.13.1
Platform (e.g. Android/iOS): iOS and Android
Platform Version: RN 0.61.5 React 16.9.0
Cordova Version: x
Node.js / npm versions: Node: v11.15.0 NPM: 6.7.0