Skip to content

fix(sync): add the conditional-write switch to the join screen - #11

Merged
rendyuwu merged 1 commit into
devfrom
fix/join-cas-switch
Oct 2, 2026
Merged

rendyuwu merged 1 commit into
devfrom
fix/join-cas-switch

Conversation

@rendyuwu

@rendyuwu rendyuwu commented Oct 2, 2026

Copy link
Copy Markdown
Owner

What

The first-run join screen now renders the same Behaviour block as Settings >
Sync: the "Endpoint honours conditional writes" switch and its off-note on S3,
and the "nothing here to turn on" note on WebDAV.

Why

Closes #3.

The join screen started from DEFAULT_SYNC_CONFIG (cas: false) and rendered
no switch for it, so a device that joined an S3 remote stored cas: false and
ran on unconditional writes until someone opened Settings > Sync.

How

  • Settings' Behaviour block moves out of SyncSection.tsx into
    src/settings/components/SyncBehaviour.tsx, beside SyncField, the other
    component both sync forms share. Text, classes, role and aria-label are
    unchanged. The component takes { config, onChange }, and Settings' handler
    still clears the "Saved" flag.
  • JoinSyncScreen.tsx renders it between the sync passphrase and the master
    password, writing into the config the join already holds.
  • No plumbing change. useJoinSync already sends configSubset(config), which
    carries cas, to sync_join and stores { ...config, enabled: true }, and
    Rust's provider_config already passes cas to S3 and drops it for WebDAV.
  • The default stays off, as the issue asks: the app never probes the endpoint,
    so turning it on is the user's call.

Testing

  • pnpm exec tsc --noEmit, pnpm run lint:imports, pnpm run format:check,
    pnpm run verify (17/17), with no test edits.

  • A Playwright run against pnpm dev, with vault_status, vault_list and
    sync_join stubbed on top of the browser IPC shim, exercised:

    • join on S3: the switch starts off and the off-note shows
    • switch to WebDAV: no switch, and the WebDAV note shows
    • back to S3, turn the switch on: the off-note hides
    • submit the join: sync_join receives config.cas: true, and the stored
      sync config has cas: true, enabled: true
    • open Settings > Sync: the switch loads on, and still turns off and brings
      the note back
  • Replacing the join screen's onChange={setConfig} with a no-op turns that run
    red at "switch turns on" and at sync_join (cas was false). Restoring it
    turns it green again.

  • pnpm exec tsc --noEmit clean

  • Manual smoke-test of the affected feature

  • (If you touched src-tauri/) cargo check clean

  • (If UI) tested in pnpm tauri:dev (isolated dev data dir)

No changes under src-tauri/. Not tested in pnpm tauri:dev yet, nor against
a real S3 endpoint.

Screenshots / GIFs

None attached. The join screen gains Settings > Sync's Behaviour block as it
already looks there.

Notes for reviewer

  • The join screen also gets the "Behaviour" caption, although its other fields
    have none. It keeps the block identical in both forms.
  • A WebDAV join shows the WebDAV note, since the whole block is shared.

The first-run join screen started from DEFAULT_SYNC_CONFIG (cas: false)
and rendered no switch for it, so a device that joined an S3 remote
stored cas: false and ran on unconditional writes until someone opened
Settings > Sync.

Settings' Behaviour block moves into SyncBehaviour, shared by both
forms: the "Endpoint honours conditional writes" switch with its
off-note on S3, the "nothing here to turn on" note on WebDAV. The join
screen renders it into the config it already sends to sync_join and
stores. The default stays off: the app never probes the endpoint.

Closes #3
@rendyuwu
rendyuwu merged commit 60e2a41 into dev Oct 2, 2026
7 checks passed
@rendyuwu
rendyuwu deleted the fix/join-cas-switch branch October 2, 2026 15:38
This was referenced Oct 2, 2026
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.

The join screen cannot turn on conditional writes for an S3 remote

1 participant