diff options
author | nik gaffney <nik@fo.am> | 2020-12-16 13:43:55 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-16 13:43:55 +0300 |
commit | 1e7da6ed20da5182f49d3bb165c49b810f28fd84 (patch) | |
tree | 3cb775f47a189436c33c6862f69ad7233fd02cac /src | |
parent | d3fa568983cf253e47389c99720c82a54df9ac0c (diff) | |
parent | b8c43e2e0b26367040746b3b7eb8b33ce5c3dd2b (diff) |
Merge branch 'master' into patch-1
Diffstat (limited to 'src')
-rw-r--r-- | src/components/EditorWrapper.vue | 16 | ||||
-rw-r--r-- | src/services/PollingBackend.js | 8 |
2 files changed, 13 insertions, 11 deletions
diff --git a/src/components/EditorWrapper.vue b/src/components/EditorWrapper.vue index 2c8573828..a2d6b27de 100644 --- a/src/components/EditorWrapper.vue +++ b/src/components/EditorWrapper.vue @@ -26,14 +26,14 @@ <p v-if="idle" class="msg icon-info"> {{ t('text', 'Document idle for {timeout} minutes, click to continue editing', { timeout: IDLE_TIMEOUT }) }} <a class="button primary" @click="reconnect">{{ t('text', 'Reconnect') }}</a> </p> - <p v-if="hasSyncCollission" class="msg icon-error"> + <p v-else-if="hasSyncCollission" class="msg icon-error"> {{ t('text', 'The document has been changed outside of the editor. The changes cannot be applied.') }} </p> - <p v-if="hasConnectionIssue" class="msg icon-info"> + <p v-else-if="hasConnectionIssue" class="msg icon-info"> {{ t('text', 'File could not be loaded. Please check your internet connection.') }} <a class="button primary" @click="reconnect">{{ t('text', 'Reconnect') }}</a> </p> </div> - <div v-if="currentSession && active" id="editor-wrapper" :class="{'has-conflicts': hasSyncCollission, 'icon-loading': !initialLoading || hasConnectionIssue, 'richEditor': isRichEditor}"> + <div v-if="currentSession && active" id="editor-wrapper" :class="{'has-conflicts': hasSyncCollission, 'icon-loading': !initialLoading && !hasConnectionIssue, 'richEditor': isRichEditor}"> <div id="editor"> <MenuBar v-if="!syncError && !readOnly" ref="menubar" @@ -55,7 +55,7 @@ <div> <MenuBubble v-if="!readOnly && isRichEditor" :editor="tiptap" - :filePath="relativePath" /> + :file-path="relativePath" /> <EditorContent v-show="initialLoading" class="editor__content" :editor="tiptap" /> @@ -381,10 +381,9 @@ export default { } } if (error === ERROR_TYPE.SOURCE_NOT_FOUND) { - this.initialLoading = false - this.$emit('close') - this.$emit('error') + this.hasConnectionIssue = true } + this.$emit('ready') }) .on('stateChange', (state) => { if (state.initialLoading && !this.initialLoading) { @@ -433,7 +432,8 @@ export default { }, reconnect() { - this.initialLoading = true + this.initialLoading = false + this.hasConnectionIssue = false if (this.syncService) { this.syncService.close().then(() => { this.syncService = null diff --git a/src/services/PollingBackend.js b/src/services/PollingBackend.js index a65300248..42349451d 100644 --- a/src/services/PollingBackend.js +++ b/src/services/PollingBackend.js @@ -159,7 +159,7 @@ class PollingBackend { if (!e.response || e.code === 'ECONNABORTED') { if (this.fetchRetryCounter++ >= MAX_RETRY_FETCH_COUNT) { console.error('[PollingBackend:fetchSteps] Network error when fetching steps, emitting CONNECTION_FAILED') - this._authority.emit('error', ERROR_TYPE.CONNECTION_FAILED, {}) + this._authority.emit('error', ERROR_TYPE.CONNECTION_FAILED, { retry: false }) } else { console.error(`[PollingBackend:fetchSteps] Network error when fetching steps, retry ${this.fetchRetryCounter}`) @@ -172,14 +172,16 @@ class PollingBackend { }) } else if (e.response.status === 403) { this._authority.emit('error', ERROR_TYPE.SOURCE_NOT_FOUND, {}) + this.disconnect() } else if (e.response.status === 404) { this._authority.emit('error', ERROR_TYPE.SOURCE_NOT_FOUND, {}) + this.disconnect() } else if (e.response.status === 503) { this.increaseRefetchTimer() - this._authority.emit('error', ERROR_TYPE.CONNECTION_FAILED, { retry: true }) + this._authority.emit('error', ERROR_TYPE.CONNECTION_FAILED, { retry: false }) console.error('Failed to fetch steps due to unavailable service', e) } else { - this.increaseRefetchTimer() + this.disconnect() this._authority.emit('error', ERROR_TYPE.CONNECTION_FAILED, { retry: false }) console.error('Failed to fetch steps due to other reason', e) } |