{"action":"created","issue":{"url":"https://api.github.com/repos/firebase/polymerfire/issues/115","repository_url":"https://api.github.com/repos/firebase/polymerfire","labels_url":"https://api.github.com/repos/firebase/polymerfire/issues/115/labels{/name}","comments_url":"https://api.github.com/repos/firebase/polymerfire/issues/115/comments","events_url":"https://api.github.com/repos/firebase/polymerfire/issues/115/events","html_url":"https://github.com/firebase/polymerfire/issues/115","id":176812880,"number":115,"title":"Implementing Offline Write Data","user":{"login":"justjoolz","id":112559,"avatar_url":"https://avatars.githubusercontent.com/u/112559?v=3","gravatar_id":"","url":"https://api.github.com/users/justjoolz","html_url":"https://github.com/justjoolz","followers_url":"https://api.github.com/users/justjoolz/followers","following_url":"https://api.github.com/users/justjoolz/following{/other_user}","gists_url":"https://api.github.com/users/justjoolz/gists{/gist_id}","starred_url":"https://api.github.com/users/justjoolz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/justjoolz/subscriptions","organizations_url":"https://api.github.com/users/justjoolz/orgs","repos_url":"https://api.github.com/users/justjoolz/repos","events_url":"https://api.github.com/users/justjoolz/events{/privacy}","received_events_url":"https://api.github.com/users/justjoolz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-09-14T04:36:20Z","updated_at":"2016-09-14T04:54:07Z","closed_at":null,"body":"What's the recommended approach for implementing offline write?\r\n\r\nI've got firebase-query syncing with app-storage/indexeddb-mirror but not sure the best approach to storing data locally and both updating the local firebase elements when offline, and the database when connectivity is regained. \r\n\r\nIn this video a Codelab is mentioned but not linked: https://youtu.be/SobXoh4rb58?t=32m27s\r\n\r\nAny pointers on how to get this setup?"},"comment":{"url":"https://api.github.com/repos/firebase/polymerfire/issues/comments/246906273","html_url":"https://github.com/firebase/polymerfire/issues/115#issuecomment-246906273","issue_url":"https://api.github.com/repos/firebase/polymerfire/issues/115","id":246906273,"user":{"login":"cdata","id":240083,"avatar_url":"https://avatars.githubusercontent.com/u/240083?v=3","gravatar_id":"","url":"https://api.github.com/users/cdata","html_url":"https://github.com/cdata","followers_url":"https://api.github.com/users/cdata/followers","following_url":"https://api.github.com/users/cdata/following{/other_user}","gists_url":"https://api.github.com/users/cdata/gists{/gist_id}","starred_url":"https://api.github.com/users/cdata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdata/subscriptions","organizations_url":"https://api.github.com/users/cdata/orgs","repos_url":"https://api.github.com/users/cdata/repos","events_url":"https://api.github.com/users/cdata/events{/privacy}","received_events_url":"https://api.github.com/users/cdata/received_events","type":"User","site_admin":false},"created_at":"2016-09-14T04:54:07Z","updated_at":"2016-09-14T04:54:07Z","body":"`app-indexeddb-mirror` is designed to work within the constraints of Firebase's available features. So, it allows for mirroring live data for offline-read, but it does not enable synchronization or conflict resolution features for Firebase.\r\n\r\nFirebase currently lacks built-in support for offline-to-online synchronization and conflict resolution. So, you must first design your own conventions for synchronization and conflict resolution. If you are willing to design your own synchronization and conflict resolution schemes (or if you don't care that a client returning online will always blindly overwrite values in Firebase), then one reasonable strategy is:\r\n\r\n 1. Observe changes to a data object that should be synchronized with Firebase.\r\n 2. When offline, cache a serialized version of each such change in a local storage layer such as localStorage or IndexedDB.\r\n 3. Re-play all recorded changes when the user returns online so that Firebase attempts to save it.\r\n 4. Remove the cached, serialized version of each change as it successfully saves to Firebase.\r\n\r\nPlease note that without any conventions for synchronization and conflict resolution, the above approach can be problematic when applied to data that multiple users might be editing.\r\n\r\nIf you are interested in a storage layer with built-in synchronization and conflict resolution features, I would personally recommend PouchDB."}}
{"actor":{"display_login":"cdata"}}