Skip to content

Fix device sync filter toggles reverting and folder exclusions overwriting - #200

Merged
callumalpass merged 1 commit into
mainfrom
fix/settings-device-filter
Nov 26, 2026
Merged

callumalpass merged 1 commit into
mainfrom
fix/settings-device-filter

Conversation

@callumalpass

Copy link
Copy Markdown
Member

Fixes two user-reported issues in Settings → On this device:

  1. Media toggles reverting to enabled: NativeSync.setDevice() waited behind any running sync pass and then ran a full reconcileAll() before updating data.device or publishing status. On large vaults, mid-pass status updates re-emitted the previous filter, and rapid toggles read the stale render-time device closure and overwrote earlier toggles.
  2. Only one excluded folder allowed: MdbaseSettingTab.refresh() returned early whenever any element inside containerEl held focus (including toggles and the Add folder / remove buttons), leaving the rendered list and device closure stale so adding a second folder replaced the first.

Changes

  • src/settingsTab.ts: Restrict the refresh() focus guard to editable text inputs (not checkboxes/buttons), and read the latest device filter at interaction time when toggling media classes or adding/removing folders.
  • src/sync/native/plugin.ts: Expose pendingDevice immediately in NativeSync.device / setStatus() while waiting to commit between passes, coalesce superseded setDevice() reconciliations, and flush any pending choice on onunload().
  • test/settingsTab.test.ts, test/native/sync.test.mjs, test/obsidian-mock.cjs: Add behaviour tests covering rapid media toggles, multiple excluded folders with focused controls, and mid-pass setDevice() coalescing.

@callumalpass
callumalpass marked this pull request as ready for review November 26, 2026 21:36
@callumalpass
callumalpass enabled auto-merge (squash) November 26, 2026 21:36
@callumalpass
callumalpass merged commit 0f492bf into main Nov 26, 2026
2 checks 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.

1 participant