-
-
Notifications
You must be signed in to change notification settings - Fork 297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Enhancement]: Graceful offline support #590 #591
base: master
Are you sure you want to change the base?
Conversation
c8e3b18
to
3e25fb1
Compare
There is a another way to implement offline-support without the dependency on github. (Not every git repo is hosted on github) Look up the navigator.onLine function given by typescript in the docs or used by another obsidian plugin here i think that approach is more direct and better without the dependence on a 3rd party website |
3e25fb1
to
57c1212
Compare
Thanks @rcv4 I didn't know about that, would have made things much easier. Updated the PR to use It will now also do a pull when the online state changes and had previously been set to |
57c1212
to
ce07cf4
Compare
A little more detail on this PR if the moderators find it helpful. From my understanding
When the device status changes to
|
Sorry for taking so long to react to this pr. Where do you see these error messages? As notices in the obsidian ui or only as logs in the console? Using |
Where do you see these error messages? You dont necessarily need internet to connect to, for example, a locally hosted git server. |
I think the correct way to solve this is to implement the same offline detection of |
I don't know what you mean with this. Could you explain it further? I still wouldn't depend on onLine, because it might prevent requests that don't exceed, but the same issue can still occur if |
Hi @Vinzent03 This PR observes the network connection changing. This compliments the error handling of
This PR recognizes the switch in the network, resetting Another example might be travelling (train/bus/subway/etc) in areas with poor or intermittent network reception or when switching your device from flight mode.
|
I don't know the exact behavior of I like the general idea behind this feature, but would like to see one of the following alternatives:
|
Hi @GollyTicker I'm afraid you misunderstood me. By saying " The example I gave above - which seems absurd to me - is if you have a single PC with no network devices/configuration to anything on which you have both your git server and in some other directory an obsidian vault with a cloned git repo - as in the same device has 2 copies of your git repo - and you are pushing and pulling from the 2nd one - not sure how you could even achieve this with no network configured - an obscure and potentially impossible setup which the existing From the docs
|
@rcv4 ,why is life so hard. 😮💨 |
Thanks for clarifying the behaviour of navigator.online. However, what about the dry git fetch as an alternative? After all, if could be used to also give more specific feedback to the user - as many git-newcomers don't know what to do, when they for instance see an denied public key. |
Hi @GollyTicker
|
Ok, I see. Using dry fetches is a complement rather than a replacement. I don't know too many details on the rest, so I can't comment on that. |
@GollyTicker you got it! This PR has 2 commits:
Not sure if it helps when considering each change in isolation. |
Check app online connectivity before attempting to pull/push changes
+ Set offline mode when there is no network connection and an remote attempt is made. + Reset offline mode flag when connectivity re-establishes and pull changes (delayed pull/push request)
ce07cf4
to
198213f
Compare
Any there plans for this PR to be merged anytime soon? |
When disconnected from the internet and Obsidian git still attempts to pull changes it throws some panicky error messages as mentioned in #590.
Check the connectivity to githubstatus before attempting to pull/push changes.