alekseykulikov/backbone-offline

Fetch loads data from the remote storage

ulitiy opened this issue · 3 comments

If I call fetch, backbone.offline calls findAll, so it tries to get data from the server no matter if it has a connection, so the user can't work offline. I think, this method shouldn't sync. It's offline library, so it should fetch from local storage and get data from the server only on the explicit call.

findAll: ->
if this.isEmpty() then @sync.full() else @sync.incremental()
JSON.parse(localStorage.getItem("#{@name}-#{id}")) for id in @allIds.values

Thanks for your issue. I will be thinking about this. You are right conceptually but I added this because it was useful and logically...

I think, we should have both functions (or options). Without offline fetch function we can't actually work offline, because we can't get local data without getting it from the server, so if user refreshes the page, html, css & js are loaded from cache due to manifest, but data needs pulling (if user is offline it's impossible).

Add option local: true for fetching only without server sync.
47d0ac3