feat: sync settings across devices via Matrix account data#1
Merged
Just-Insane merged 5 commits intodevfrom Mar 21, 2026
Merged
feat: sync settings across devices via Matrix account data#1Just-Insane merged 5 commits intodevfrom
Just-Insane merged 5 commits intodevfrom
Conversation
- 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
Deploying with
|
| Status | Preview URL | Commit | Alias | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! | https://pr-1-sable.justin-tech.workers.dev | 6b6357b | pr-1 |
Sat, 21 Mar 2026 23:35:45 GMT |
Just-Insane
added a commit
that referenced
this pull request
Mar 22, 2026
With classic sync, RoomViewHeader creates Thread objects via room.createThread(id, rootEvent, [], false) — passing no initialEvents. This means thread.events starts as just [rootEvent] (or empty). Two bugs resulted: 1. The gate `if (fromThread.length > 0)` blocked the live-timeline fallback. Since thread.events = [rootEvent], length was 1 (truthy), but after filtering the root out the array was empty — yielding zero replies even though the events were present in the main room timeline. Fix: compute the filtered array first, then gate on its length so the fallback is reached when the thread object has no actual replies yet. 2. Even after #1, subsequent renders and read-receipt logic used thread.events (empty) rather than the live timeline. Fix: add a mount-time useEffect that backfills matching events from the unfiltered live timeline into the Thread object via thread.addEvents() so the authoritative source is populated for future interactions.
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.
What
Adds opt-in settings synchronisation across devices using Matrix account data (
moe.sable.app.settings), plus a JSON export/import fallback for users who prefer manual control.How it works
usePushNotifications,useInAppNotifications,useSystemNotifications,pageZoom,isPeopleDrawer,isWidgetDrawer,memberSortFilterIndex,developerTools,settingsSyncEnabledJSON export / import
Available regardless of whether sync is enabled. Export triggers a browser download; import opens a file picker and merges the selected file into current settings (same schema validation as the sync path).
Files changed
src/types/matrix/accountData.tsSableSettings = 'moe.sable.app.settings'enum valuesrc/types/matrix-sdk-events.d.ts'moe.sable.app.settings'inAccountDataEvents(removesas nevercasts)src/app/state/settings.tssettingsSyncEnabled: boolean(defaultfalse)src/app/utils/settingsSync.tssrc/app/hooks/useSettingsSync.tssrc/app/pages/client/ClientNonUIFeatures.tsxSettingsSyncFeaturefor session lifetimesrc/app/features/settings/general/General.tsxSettingsSyncSectionUIsrc/app/utils/settingsSync.test.tssrc/app/hooks/useSettingsSync.test.tsx