File tree 2 files changed +20
-7
lines changed
2 files changed +20
-7
lines changed Original file line number Diff line number Diff line change @@ -2178,7 +2178,7 @@ const DefaultController = {
2178
2178
}
2179
2179
return Promise . resolve ( results ) ;
2180
2180
} ) ;
2181
- } else {
2181
+ } else if ( target instanceof ParseObject ) {
2182
2182
if ( ! target . id ) {
2183
2183
return Promise . reject ( new ParseError (
2184
2184
ParseError . MISSING_OBJECT_ID ,
@@ -2196,15 +2196,14 @@ const DefaultController = {
2196
2196
params ,
2197
2197
options
2198
2198
) . then ( async ( response ) => {
2199
- if ( target instanceof ParseObject ) {
2200
- target . _clearPendingOps ( ) ;
2201
- target . _clearServerData ( ) ;
2202
- target . _finishFetch ( response ) ;
2203
- }
2199
+ target . _clearPendingOps ( ) ;
2200
+ target . _clearServerData ( ) ;
2201
+ target . _finishFetch ( response ) ;
2204
2202
await localDatastore . _updateObjectIfPinned ( target ) ;
2205
2203
return target ;
2206
2204
} ) ;
2207
2205
}
2206
+ return Promise . resolve ( ) ;
2208
2207
} ,
2209
2208
2210
2209
async destroy ( target : ParseObject | Array < ParseObject > , options : RequestOptions ) : Promise < Array < void > | ParseObject > {
@@ -2278,7 +2277,6 @@ const DefaultController = {
2278
2277
return Promise . resolve ( target ) ;
2279
2278
} ) ;
2280
2279
}
2281
- await localDatastore . _destroyObjectIfPinned ( target ) ;
2282
2280
return Promise . resolve ( target ) ;
2283
2281
} ,
2284
2282
Original file line number Diff line number Diff line change @@ -1257,6 +1257,21 @@ describe('ParseObject', () => {
1257
1257
expect ( controller . ajax ) . toHaveBeenCalledTimes ( 0 ) ;
1258
1258
} ) ;
1259
1259
1260
+ it ( 'fetchAll with null' , async ( ) => {
1261
+ CoreManager . getRESTController ( ) . _setXHR (
1262
+ mockXHR ( [ {
1263
+ status : 200 ,
1264
+ response : [ { } ]
1265
+ } ] )
1266
+ ) ;
1267
+ const controller = CoreManager . getRESTController ( ) ;
1268
+ jest . spyOn ( controller , 'ajax' ) ;
1269
+
1270
+ const results = await ParseObject . fetchAll ( null ) ;
1271
+ expect ( results ) . toEqual ( undefined ) ;
1272
+ expect ( controller . ajax ) . toHaveBeenCalledTimes ( 0 ) ;
1273
+ } ) ;
1274
+
1260
1275
it ( 'fetchAll unique instance' , async ( ) => {
1261
1276
ParseObject . disableSingleInstance ( ) ;
1262
1277
const obj = new ParseObject ( 'Item' ) ;
You can’t perform that action at this time.
0 commit comments