2

So I heard that firebase has no real out of the box support for starting up a web app in offline mode.

Say you have a Todo Web App. You can login to google or something, and then the todos are saved under the uid to firebase. So that if you open the app on whatever device, the todos will always be synced.

Firebase makes sure everything still works, when the network disconnects when you are working on the app already. So there is no problem.

But say you are using this web app on your mobile. And you open up the app offline. So now firebase seems to have no idea how to handle this. So what could I best do to make sure things still work?

Any solutions. So I can save the todos to local storage or something. And open up those todos from local storage, only when the app starts up without connection.

I tried a bit, but I find it hard to get this working, especially making sure that firebase still understand the new state when online again.

Any directions, tips are highly appreciated.

Kasper
  • 12,594
  • 12
  • 41
  • 63
  • 2
    This is an interesting problem, to be sure. However, it is unfortunately too broad to offer a good answer as it stands currently. There are so many factors involved in this process that attempting to demonstrate a working solution would be a full program of it's own. It would be better for you to break this down into smaller issues, present your attempts, and describe challenges with the attempts. – Claies Feb 09 '16 at 01:54
  • See my answer [here](https://stackoverflow.com/a/47767664/998102). In short as you say you load data from localStorage, but instead of using it directly you should populate firebase with it. Data will then get sync'd to remote once the app goes online, like it would normally happen with firebase during a momentary connection loss. Far from being expert with firebase but so far so good for me using this approach. – undefinederror Dec 13 '17 at 03:12

0 Answers0