Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions js/editor.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/editor.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-editors.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-editors.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-files.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-files.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-public.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-public.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-text.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-text.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-viewer.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-viewer.js.map

Large diffs are not rendered by default.

11 changes: 8 additions & 3 deletions src/services/SyncService.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,22 @@ class SyncService {
}

async open({ fileId, initialSession }) {
this.on('change', ({ sessions }) => {
const onChange = ({ sessions }) => {
this.sessions = sessions
})
}
this.on('change', onChange)

const connect = initialSession
? Promise.resolve(new Connection({ data: initialSession }, {}))
: this._api.open({ fileId })
.catch(error => this._emitError(error))

// TODO: Only continue if a connection was made
this.connection = await connect
if (!this.connection) {
this.off('change', onChange)
// Error was already emitted in connect
return
}
this.backend = new PollingBackend(this, this.connection)
this.version = this.connection.docStateVersion
this.emit('opened', {
Expand Down