Skip to content

Clear WatermelonDB and reset sync state when switching Synkronus servers #109

@Ndacyayisenga-droid

Description

@Ndacyayisenga-droid

When a user changes the Synkronus server URL in Formulus, the application does not reset local persistence or sync metadata. As a result, data and sync state from the previously configured server are reused against the newly selected server, leading to cross-server data corruption.

Root Cause

Although the API layer detects a server URL change and clears its internal configuration cache, local state is not cleared:

WatermelonDB retains all existing observation records.

Sync cursors (@last_seen_version, @last_attachment_version) stored in AsyncStorage remain unchanged.

This causes the client to treat the new server as a continuation of the old one.

Current Behavior

  • Server URL is updated via settings.
  • API config cache is reset.
  • Local database contents and sync metadata persist unchanged.
  • Next sync operation mixes old-server state with the new server.

Expected Behavior

On server URL change, the app should:

  • Fully clear local observation data.
  • Reset sync cursors to an initial state (e.g. version 0 or unset).
  • Ensure no legacy app bundles or cached metadata interfere with the new server.
  • Optionally notify the user that local data will be wiped.

Cc @r0ssing

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions