Closed iLiviu closed 4 years ago
Hmm. This one is a bit weird. I was almost certain that normal failed HTTP requests should not throw a SyncError
, but that those errors are actual real issues with the sync itself. IIRC the reason the widget does this is so that you have to disconnect and with that clear the cache, so that the re-sync can work.
@galfert @michielbdejong Do you remember anything about this perhaps? I feel like this might have been changed accidentally when we (optionally) switched from old-school AJAX to fetch()
. But haven't looked into it yet.
I also don't think it should emit a SyncError
event, but I'm not sure either.
From what i see in the code, the intention is clearly to be emitted on timeout or failed HTTP request. For real issues (unexpected HTTP responses) a generic Error
is emitted instead.
It might be of value go through the unit tests and see if these cases are properly tested. I reworked the lowest level of unit tests to be run against both XHR and fetch(), but not the unit tests for the higher levels.
On Feb 25, 2019, at 9:48 AM, Liviu Iancuta notifications@github.com wrote:
From what i see in the code, the intention is clearly to be emitted on timeout or failed HTTP request. For real issues (unexpected HTTP responses) a generic Error is emitted instead.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
Doug Reeder reeder.29@gmail.com Recall your notes by context, with Serene Notes: https://serenenotes.hominidsoftware.com/ My gender pronouns are: he, him, his.
The update to
sync.js
on RemoteStorage library that fixed a bug on emitting aSyncError
when sync fails, revealed a problem in the widget when this error is emitted. The widget's state turns to error and it displays the error text, replacing theoffline
state, which was set right before this error (the SyncError event is emitted when the backend rejects it's promise on a HTTP request due to network error or timeout, and when this happens anetwork-offline
event is also emitted, which widget catches and sets appropriate state). Because theerror
state is set, the widget won't return to it'sconnected
state even when app comes back online. So i think settingoffline
state is enough, andSyncError
should just be ignored.