Understanding the offline behavior of our app is vital to becoming a productive contributor to the Expensify codebase. Our mission is to support our u

Search code, repositories, users, issues, pull requests...

submited by
Style Pass
2024-09-28 10:30:05

Understanding the offline behavior of our app is vital to becoming a productive contributor to the Expensify codebase. Our mission is to support our users in every possible environment, and often our app is used in places where a stable internet connection is not guaranteed.

The most important concept to keep in mind while reading this document is that we want to allow users to do as much as possible when offline. At first, this might seem impossible because almost everything the user can touch in our app is related to an API request. However, in many cases, we can save that API request and assume it will succeed when the user is back online. We then allow the user to proceed as if their request already succeeded. We call this an optimistic response. Here, we use the word optimistic to indicate that we're confident the request will succeed when the user is online, and we know what that successful response will look like.

API Request: We send a request to the API to ensure the change is saved in the database. This way the chat is pinned on all the user's devices, and will remain pinned even if they leave the app and come back.

Leave a Comment