-
-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Send only changed properties to cloud by default when updating object #401
Comments
Thanks for opening this issue!
|
PR #406 was a great step towards simplification. To follow up on the example above, the code after the PR would be: // Parse ObjC SDK
PFObject *obj = [PFObject objectWithClassName:@"Example"];
obj[@"key"] = @"value1";
[obj save];
obj[@"key"] = @"value2";
[obj save];
// Parse Swift SDK
struct Example: ParseObject {
var objectId: String?
var createdAt: Date?
var updatedAt: Date?
var ACL: ParseACL?
var originalData: Data?
var key: String?
}
let obj = Example()
obj.key = "value1"
obj.save()
let updatedObj = try obj.key.set(\.key, to: "value2")
let savedUpdatedObj = try await updatedObj.save()
// or without declaring new vars for every state
var obj = Example()
obj.key = "value1"
obj.save()
obj = try obj.key.set(\.key, to: "value2")
obj = try await obj.save() Is that correct? If so, I think we can reword the warning in the migration guide, but not remove it completely. Because a developer still has to keep in mind that there is a special approach (even though simplified thanks to #406) needed to only send updated keys to the server, and they cannot simply use |
New Feature / Enhancement Checklist
Current Limitation
The Parse Swift SDK requires additional code overhead and developer considerations when updating objects. Specifically, to send only changed properties to the server, the SDK requires the developer to create an object clone from
ParseObject.mergeable
and override an internal methodParseObject.merge
. The same behavior is achieved by other Parse SDKs without these efforts.The disadvantages are:
ParseObject.merge
method. For example, if a new custom property is added to the object but not to the internal method, it creates data inconsistencies that may lead to bugs that are difficult to track down.Feature / Enhancement Description
The Parse Swift SDK should send only the changed properties to the server by default. Without requiring the developer to override an internal method of
ParseObject
and without having to clone the object fromParseObject.mergeable
.Example Use Case
The following examples compare how to update a saved object in the Parse ObjC SDK vs. the Parse Swift SDK.
Alternatives / Workarounds
n/a
References
The text was updated successfully, but these errors were encountered: