feat: sync app settings across devices via Matrix account data#515
Merged
7w1 merged 7 commits intoSableClient:devfrom Mar 25, 2026
Merged
feat: sync app settings across devices via Matrix account data#5157w1 merged 7 commits intoSableClient:devfrom
7w1 merged 7 commits intoSableClient:devfrom
Conversation
Contributor
shouldn’t the event type be as we don’t have the right to the |
Contributor
Author
Hmm, probably yea - actually, it's correct in the source, just wrong in the description |
dozro
requested changes
Mar 24, 2026
Contributor
Author
|
@dozro should be good now for those changes. |
7w1
approved these changes
Mar 25, 2026
- Add SableSettings account data event type (moe.sable.app.settings) - Add settingsSyncEnabled setting (default off, device-local) - serializeForSync/deserializeFromSync utilities with versioned schema - Echo-token loop prevention: own uploads don't re-apply on echo - Debounced (2 s) upload on settings change - JSON export (browser download) and import (file picker) - SettingsSyncSection in General settings with sync toggle, status, and export/import buttons - 39 new tests covering utilities and hook behaviour
9efdf64 to
540e78c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds cross-device settings sync by storing Sable's app settings in a Matrix account data event (
moe.sable.app.settings). Change a setting on one device and it propagates to your other sessions automatically.Fixes #
Type of change
Checklist:
AI disclosure:
What the generated code does:
settingsSync.ts— Serialise/deserialise helpers that convert the settings state to/from the account data wire format. Unknown keys are preserved so older clients don't silently drop data from newer ones.useSettingsSync.ts— The main sync hook. On mount it reads any existing account data and merges it into local state. It then listens for live updates from other devices viaClientEvent.AccountData. Uploads are debounced by 2 seconds and each one embeds a randomsynctoken; when the server echoes the event back, the hook recognises its own token and skips re-applying it. ExposessettingsSyncStatusAtomandsettingsSyncLastSyncedAtomfor UI feedback.General.tsx— Adds a "Sync settings across devices" toggle and a JSON export/import section for manually backing up and restoring settings.ClientNonUIFeatures.tsx— Mounts the sync hook once at the client root so it stays active for the whole session.settings.ts— AddssettingsSyncEnabled: boolean(defaultfalse) to the settings atom.Type files — Registers
moe.sable.app.settingsin the account data type registry so SDK callbacks are typed correctly.Tests cover the serialise/deserialise helpers, load-on-mount, merge behaviour, echo-loop skipping, debounced uploads, and error states.