diff options
author | Max <max@nextcloud.com> | 2022-03-07 11:22:14 +0300 |
---|---|---|
committer | nextcloud-command <nextcloud-command@users.noreply.github.com> | 2022-03-09 08:23:18 +0300 |
commit | fd6395128cfb4ddc2aa28b1587903202eecdc16a (patch) | |
tree | 20f80cd5da2ab19ee76f6bf503634b054c27e580 /src | |
parent | 44737f20095f30ef2440f8667a21e21decf9d648 (diff) |
performance: fetch content during session creation
Signed-off-by: Max <max@nextcloud.com>
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/services/SyncService.js | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/services/SyncService.js b/src/services/SyncService.js index 34d10b15e..1fac516fe 100644 --- a/src/services/SyncService.js +++ b/src/services/SyncService.js @@ -106,11 +106,12 @@ class SyncService { document: this.document, session: this.session, }) - const fetched = await this._fetchDocument() + const content = connectionData.content + || await this._fetchDocument() this.emit('loaded', { document: this.document, session: this.session, - documentSource: '' + fetched.data, + documentSource: '' + content, }) } @@ -133,7 +134,7 @@ class SyncService { this.emit('error', ERROR_TYPE.LOAD_ERROR, error.response.status) } throw error - }) + }) } _fetchDocument() { @@ -144,9 +145,11 @@ class SyncService { sessionToken: this.session.token, token: this.options.shareToken, }, { + // Axios normally tries to parse string responses as json. + // Just return the plain content here. transformResponse: [(data) => data], } - ) + ).then(response => response.data) } updateSession(guestName) { |