Skip to content

Skip reload when merge produces no local changes#33

Open
Cusanity wants to merge 1 commit into
gitalexcampos:masterfrom
Cusanity:skip-reload-no-changes
Open

Skip reload when merge produces no local changes#33
Cusanity wants to merge 1 commit into
gitalexcampos:masterfrom
Cusanity:skip-reload-no-changes

Conversation

@Cusanity
Copy link
Copy Markdown
Contributor

@Cusanity Cusanity commented May 2, 2026

When syncing highlights, the plugin previously always wrote the merged JSON and reloaded the document — even when the merge produced no actual changes to local annotations. This caused unnecessary document reloads on every sync.

Changes

  • get_newer() now returns (item, changed) to fix false-positive change detection (Lua table identity comparison always returned true for different server/local objects with equal timestamps)
  • merge_highlights() tracks and returns a local_changed flag across all three change paths (server-deleted, new-from-server, server-newer)
  • onSync() early-returns when no changes, skipping JSON write and document reload

- get_newer() now returns (item, changed) boolean to fix false-positive
  change detection caused by Lua table identity comparison
- merge_highlights() tracks and returns local_changed flag
- onSync() early-returns when no changes, skipping JSON write and
  document reload
@Cusanity Cusanity force-pushed the skip-reload-no-changes branch from b4480e7 to 833ea93 Compare May 2, 2026 20:28
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.

1 participant