Don't store transient arrays returned by RPC

This commit is contained in:
Scott Kyle 2015-10-08 15:31:29 -07:00
parent 665e63aa6f
commit 310e3d7a03
2 changed files with 5 additions and 3 deletions

View File

@ -14,7 +14,7 @@ function create(realmId, info) {
let size = info.size; let size = info.size;
results[realmKey] = realmId; results[realmKey] = realmId;
results[idKey] = info.resultsId; results[idKey] = info.id;
results[resizeListKey](size); results[resizeListKey](size);

View File

@ -239,10 +239,10 @@ using RPCRequest = std::function<NSDictionary *(NSDictionary *dictionary)>;
} }
JSObjectRef jsObject = JSValueToObject(_context, value, NULL); JSObjectRef jsObject = JSValueToObject(_context, value, NULL);
RPCObjectID oid = [self storeObject:jsObject];
if (JSValueIsObjectOfClass(_context, value, RJSObjectClass())) { if (JSValueIsObjectOfClass(_context, value, RJSObjectClass())) {
realm::Object *object = RJSGetInternal<realm::Object *>(jsObject); realm::Object *object = RJSGetInternal<realm::Object *>(jsObject);
RPCObjectID oid = [self storeObject:jsObject];
return @{ return @{
@"type": @(RJSTypeGet(realm::PropertyTypeObject).c_str()), @"type": @(RJSTypeGet(realm::PropertyTypeObject).c_str()),
@"id": @(oid), @"id": @(oid),
@ -251,6 +251,7 @@ using RPCRequest = std::function<NSDictionary *(NSDictionary *dictionary)>;
} }
else if (JSValueIsObjectOfClass(_context, value, RJSArrayClass())) { else if (JSValueIsObjectOfClass(_context, value, RJSArrayClass())) {
realm::ObjectArray *array = RJSGetInternal<realm::ObjectArray *>(jsObject); realm::ObjectArray *array = RJSGetInternal<realm::ObjectArray *>(jsObject);
RPCObjectID oid = [self storeObject:jsObject];
return @{ return @{
@"type": @(RJSTypeGet(realm::PropertyTypeArray).c_str()), @"type": @(RJSTypeGet(realm::PropertyTypeArray).c_str()),
@"id": @(oid), @"id": @(oid),
@ -260,9 +261,10 @@ using RPCRequest = std::function<NSDictionary *(NSDictionary *dictionary)>;
} }
else if (JSValueIsObjectOfClass(_context, value, RJSResultsClass())) { else if (JSValueIsObjectOfClass(_context, value, RJSResultsClass())) {
realm::Results *results = RJSGetInternal<realm::Results *>(jsObject); realm::Results *results = RJSGetInternal<realm::Results *>(jsObject);
RPCObjectID oid = [self storeObject:jsObject];
return @{ return @{
@"type": @"ObjectTypesRESULTS", @"type": @"ObjectTypesRESULTS",
@"resultsId": @(oid), @"id": @(oid),
@"size": @(results->size()), @"size": @(results->size()),
@"schema": [self objectSchemaToJSONObject:results->object_schema] @"schema": [self objectSchemaToJSONObject:results->object_schema]
}; };