Skip to content

Conversation

DominicGBauer
Copy link
Contributor

@DominicGBauer DominicGBauer commented Oct 15, 2024

Description

There was an issue where hasSynced was being reset after becoming true. This issue was due to the update function in the SyncStatus class using the copy method and expecting default values to be persisted. However when the update function is run and copy is invoked it does not know about the default values in the update function so it overwrites the previous values with null.

This fixes the issue by not relying on default values from the update function.

Previously

status = { connected: true, hasSynced: true }

status.update(connected:false)

status = { connected false, hasSynced: null }

Now

status = { connected: true, hasSynced: true }

status.update(connected:false)

status = { connected false, hasSynced: true }

I have also included an example implementation of using hasSynced in the demo.

Testing

Implemented the change in the demo and tested to confirm it shows "busy syncing..." when hasSynced is not true and shows the content otherwise

@DominicGBauer DominicGBauer merged commit b6068d5 into main Oct 15, 2024
3 checks passed
@DominicGBauer DominicGBauer deleted the fix/sync-status-not-updating-correctly branch October 15, 2024 09:33
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.

2 participants