Fix detecting changes in sync options #288
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The sync worker keeps the current resolved
ResolvedSyncOptions
in a field and callsResolvedSyncOptions.applyFrom
for new connections to see if the options have changed. That method is supposed to return a new options instance and a flag indicating whether the options have changed. The sync worker would restart the sync client with changed options if they did.applyFrom
used to compare the new options with the added options to determine whether the options have changed. It should compare the new options with the old options instead, which is fixed in this PR.In practice this doesn't make a difference because two clients are supposed to send the same option, but one edge-case that is fixed here is that upgrading the sync worker and then downgrading the SDK could lead to a sync abort+reconnect every time a new tab is opened.