Skip to content

Conversation

@stevensJourney
Copy link
Contributor

@stevensJourney stevensJourney commented Aug 5, 2024

Overview

The hasSycned status would be retained after calls to disconnectAndClear have been made.

Steps to reproduce the issue:

  • Log in
  • Wait for first sync > works fine
  • Log out
  • Log in
  • Wait for first sync > no longer works

The previous hasSynced: true would cause the check to immediately pass before syncing had completed on the second round.

This PR clears the hasSynced status when disconnecting and clearing. The PowerSync client typically checks the setting in the initialize method which won't be called again, but the status will be updated on the next full sync when lastSyncedAt has been set.

Testing

This was tested on MacOS by syncing locally then logging out. The local PowerSync service was then stopped to delay the syncing process. The next login should show the loading message until a sync has occurred.

The first test is without the fix, the second test contains the fix.

fix_has_synced.mp4

On web it was observed that a large queue of sync status updates were present after disconnectAndClear this was due to the crudLoop not ending when the StreamingSyncImplementation was aborted. A break for uploads was added.

This only shows the fix present.

web_hassynced.mp4

@stevensJourney stevensJourney marked this pull request as ready for review August 5, 2024 15:53
@stevensJourney stevensJourney requested a review from rkistner August 5, 2024 15:53
mugikhan
mugikhan previously approved these changes Aug 5, 2024
 - powersync@1.6.4
 - powersync_attachments_helper@0.6.3+1
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.

3 participants