Optimistic Response is not generated while offline or bad internet connection
See original GitHub issueBug 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:
client.offlineMutate({
idField: 'id',
mutation: SEND_MESSAGE,
optimisticResponse,
update: () => sendMessageUpdate(chatId),
variables: {
chatId,
clientGeneratedUUID: messageUUID,
forwardedMessages: [],
images: mappedImages,
message,
},
})
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
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (5 by maintainers)

Top Related StackOverflow Question
You were right, I had a problem in my
sendMessageUpdatefunction. 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.
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