Skip to content

fix(local-replica): Addresses the external-file-change regression described in #396. - #398

Merged
zeyugao merged 1 commit into
overleaf-workshop:masterfrom
Heinz217:fix/local-replica-external-file-sync
Aug 25, 2026
Merged

fix(local-replica): Addresses the external-file-change regression described in #396.#398
zeyugao merged 1 commit into
overleaf-workshop:masterfrom
Heinz217:fix/local-replica-external-file-sync

Conversation

@Heinz217

@Heinz217 Heinz217 commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Changes

  • Add the opt-in setting overleaf-workshop.localReplica.syncOnFileChange.enabled.
  • Keep editor-save-based synchronization as the default behavior.
  • When enabled, use localWatcher.onDidChange to detect modifications made by external tools.
  • Keep the file-system listener and editor-save listener mutually exclusive to avoid handling the same editor save through both listeners.
  • Keep the existing create and delete synchronization unchanged.

Rationale

Commit debdcb5 replaced file-system change events with onDidSaveTextDocument to prevent unwanted synchronization caused by Git operations and build tools (#299 and #323).

However, changes made outside the VS Code editor, such as edits from scripts or AI coding tools, no longer produce an editor-save event and therefore are not uploaded.

This change provides an explicit opt-in for users who need external-file synchronization while preserving the current safer behavior by default. When the option is enabled, changes made by Git or build tools may also be synchronized.

This PR only restores the missing external-file-change trigger. It does not change the bypassCache, OT conflict handling, or merge implementation. The Windows path comparison handled separately by #397 is also outside the scope of this PR.

Testing

  • npm run compile — passed
  • npm run lint — passed with two pre-existing warnings
  • git diff --check — passed
  • Manually tested on Windows with a Local Replica project

@iamhyc iamhyc left a comment

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.

LGTM

@iamhyc
iamhyc requested review from QianrenLi and zeyugao August 22, 2026 12:37
@zeyugao

zeyugao commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator

I am not familiar with the local replica mode. But if the .syncOnFileChange.enabled is not enabled by default, then how shall we update the external changes to the overleaf.

@Heinz217

Copy link
Copy Markdown
Contributor Author

Thanks for asking @zeyugao. To clarify, “external changes” here means changes made to local files by tools outside the VS Code editor, such as scripts or AI coding tools. When this option is disabled, files saved in VS Code are still uploaded normally, and changes made on Overleaf are still pulled into the local replica. Only external modifications to existing local files are not uploaded automatically. Thus, users who need this can enable the option.

It is disabled by default to avoid unintentionally syncing file changes caused by Git operations or build tools, as discussed in #299 and #323.

@zeyugao

zeyugao commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

It seems that it is more likely a workaround instead of a solution. But merge it for now and perhaps waiting for a conflict resolution like git.

@zeyugao
zeyugao merged commit 08b65b2 into overleaf-workshop:master Aug 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants