Skip to content
Open
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
1 change: 1 addition & 0 deletions src/services/SyncService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ class SyncService {
this.bus.emit('stateChange', { dirty: true })
}
if (!this.hasActiveConnection()) {
this.#sending = false

@mejo- mejo- Jul 9, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a sensible fix to me. We return early but don't reset this.#sending.

return
}
const sendable = this.#outbox.getDataToSend()
Expand Down
11 changes: 11 additions & 0 deletions src/tests/services/SyncService.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,17 @@ const initialData = {
const openResult = { connection, data: initialData }

describe('Sync service', () => {
it('resets #sending when there is no active connection', async () => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test looks useless to me, I'd drop it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, but I'm not at home right now. When I am, I'll definitely make some edits based on your suggestions. Thank you very much!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@omnizs38 can you simply drop the test altogether from the PR?

Also, out of curiosity:

Did you run into an actual bug that you're fixing here, or was it a random finding (by AI)?

const { connection, openConnection } = provideConnection(
{ fileId: 123, relativePath: './' },
vi.fn(),
vi.fn(),
)
const service = new SyncService({ connection, openConnection })
await service.sendStepsNow()
await expect(service.sendStepsNow()).resolves.toBeUndefined()
})

it('opens a connection', async () => {
const getBaseVersionEtag = vi.fn()
const setBaseVersionEtag = vi.fn()
Expand Down