Redesign @AsyncOpen and @AutoOpen initialisers to allow setting a client reset modes for any sync configuration#8109
Open
dianaafanador3 wants to merge 2 commits intomasterfrom
Open
Redesign @AsyncOpen and @AutoOpen initialisers to allow setting a client reset modes for any sync configuration#8109dianaafanador3 wants to merge 2 commits intomasterfrom
@AsyncOpen and @AutoOpen initialisers to allow setting a client reset modes for any sync configuration#8109dianaafanador3 wants to merge 2 commits intomasterfrom
Conversation
2132964 to
0824d78
Compare
0824d78 to
c7433a7
Compare
tgoyne
reviewed
Feb 9, 2023
CHANGELOG.md
Outdated
Comment on lines
12
to
18
| * `AsyncOpen.init(appId:partitionValue:configuration:timeout)` and | ||
| `AutoOpen.init(appId:partitionValue:configuration:timeout)` will change behavior. Previously | ||
| injecting both the configuration and a partition value will make the property wrappers to set | ||
| the injected configuration (if not nil) combine with the syncConfiguration from the | ||
| `user.configuration(partitionValue:)`. This will change to either user the injected configuration (if not nil) | ||
| or the configuration obtained from `user.configuration(partitionValue:)` for the current logged user. | ||
| This API will be deprecated on the next major release. |
Member
There was a problem hiding this comment.
Both the old and new behavior seems incorrect? If a non-nil configuration is provided I would expect it to use exactly that configuration except with the partition value changed to the supplied one.
leemaguire
reviewed
Feb 9, 2023
RealmSwift/SwiftUI.swift
Outdated
| timeout: UInt? = nil) { | ||
| let app = ObservableAsyncOpenStorage.configureApp(appId: appId, timeout: timeout) | ||
| // Store property wrapper values on the storage | ||
| storage = ObservableAsyncOpenStorage(asyncOpenKind: .asyncOpen, app: app, configuration: nil, partitionValue: nil) |
Contributor
There was a problem hiding this comment.
If the configuration is nil how does it know about the initialSubscriptions?
Member
|
This is an unnecessary breaking change which breaks things that seem completely reasonable. |
c7433a7 to
36a62fc
Compare
… client reset mode for any sync configuration, and avoid confusion with the configuration and the sync configuration from the user on each intialiser.
36a62fc to
88c543a
Compare
88c543a to
705561b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Redesign
@AsyncOpenand@AutoOpeninitialisers to allow setting a client reset mode for any sync configuration, and avoid confusion with the configuration and the sync configuration from the user on each intialiser.Currently, setting a client reset mode for @AsyncOpen and @AutOOpeN is not working correctly, which mainly has to do with the implementation approach within the property wrappers which uses the sync configuration from the sync type (depending on the initialiser, flx or pbs) and combine it with the injected configuration (which can come from the initialiser or and environment value).
In this PR I'm proposing a redesign of the initials for the both @AsyncOpen and @AutOOpeN to avoid confusion of which sync configuration is been used internally.
This PR has some breaking changes, which only should affect users in cases where they were using this feature incorrectly (for example, if they were injecting a configuration with a different partition value that the one on the initialiser or a configuration with a different sync type that the one from the initialiser).