nextcloud / text

📑 Collaborative document editing using Markdown
GNU Affero General Public License v3.0
552 stars 91 forks source link

Reconnect handling #4943

Open juliusknorr opened 1 year ago

juliusknorr commented 1 year ago

I noticed when testing #4938 that there seems to be a case when a connection is offline long enough that the reconnect is not working as expected.

When trying to address the issue there by dropping the disconnected websocket provider with the following patch I noticed that after reconnecting the offline client would no longer send changes while still picking up the ones from the other clients.

diff --git a/src/components/Editor.vue b/src/components/Editor.vue
index 407004d99..879928d03 100644
--- a/src/components/Editor.vue
+++ b/src/components/Editor.vue
@@ -423,6 +423,7 @@ export default {
                reconnect() {
                        this.contentLoaded = false
                        this.hasConnectionIssue = false
+                       this.$providers.forEach(p => p.destroy())
                        this.close().then(this.initSession)
                        this.idle = false
                },
juliusknorr commented 1 year ago

Actually seems like after the reconnect the step is not pushed at all so we have a diverging state between both clients

Failing step:

Screenshot 2023-10-31 at 15 23 16

First successful push after reconnect:

Screenshot 2023-10-31 at 15 23 46
juliusknorr commented 11 months ago

https://github.com/nextcloud/text/pull/5082 was an attempt but unclear how it could have an effect, needs further debugging.

juliusknorr commented 11 months ago

Idea: