Skip to content
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

cleanup(SyncService): this.sessions and this.steps #5188

Merged
merged 1 commit into from
Jan 2, 2024
Merged
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
10 changes: 0 additions & 10 deletions src/services/SyncService.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,6 @@ class SyncService {
this._api = new SessionApi(options)
this.connection = null

this.sessions = []

this.steps = []
this.stepClientIDs = []

this.lastStepPush = Date.now()
Expand All @@ -94,10 +91,6 @@ class SyncService {
}

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

const connect = initialSession
? Promise.resolve(new Connection({ data: initialSession }, {}))
Expand All @@ -106,7 +99,6 @@ class SyncService {

this.connection = await connect
if (!this.connection) {
this.off('change', onChange)
// Error was already emitted in connect
return
}
Expand Down Expand Up @@ -208,7 +200,6 @@ class SyncService {
return { step: s.lastAwarenessMessage, clientId: s.clientId }
})
const newSteps = [...awareness]
this.steps = [...this.steps, ...awareness.map(s => s.step)]
for (let i = 0; i < steps.length; i++) {
const singleSteps = steps[i].data
if (this.version < steps[i].version) {
Expand All @@ -220,7 +211,6 @@ class SyncService {
continue
}
singleSteps.forEach(step => {
this.steps.push(step)
newSteps.push({
step,
clientID: steps[i].sessionId,
Expand Down