Skip to Content
PagesVersion History

Version History

localWiki tracks saved versions of a page so you can review changes over time and recover previous content.

Viewing version history

Open any page and click the History icon in the TopBar (clock icon). The version history panel slides open on the right side, showing a timeline of saved versions ordered by timestamp.

Click any version to select it. The selected version is highlighted in the timeline.

Comparing versions

With a version selected, click Compare with Current to view a diff between the selected version and the latest version. The diff viewer shows added and removed content inline.

Restoring a version

With a version selected, click Restore. A confirmation prompt appears asking you to confirm. Restoring replaces the current page content with the selected version’s content.

How versions are created

Versions are created by the compaction engine, not on every keystroke. The editor buffers individual Yjs updates (tier 1, “hot updates”) and when the buffer crosses a threshold, compaction merges them into a snapshot.

Three-tier compaction

localWiki uses a three-tier storage engine to balance performance and history retention:

  1. Tier 1 — Hot updates: Individual Yjs updates appended on every save (approximately every 150ms of idle time).
  2. Tier 2 — Compacted snapshots: When tier 1 accumulates 50 updates, they are merged into a single compacted Yjs state vector.
  3. Tier 3 — History archive: Each time a new tier 2 snapshot is created, the previous tier 2 snapshot is archived into tier 3 as an immutable history entry.

This means each compaction cycle archives the prior snapshot and replaces it with a fresh merged snapshot. History grows by one entry per compaction cycle.

Compaction is automatic. It runs in the background and is triggered when the hot update count reaches the threshold (default 50 updates). A background task also checks every 30 seconds.

Storage impact

Each history snapshot stores a full Yjs state vector (not a diff), so pages with many large revisions will consume more disk space. The compaction engine prevents unbounded growth of tier 1 updates by merging them into compact snapshots.

Last updated on