File tree Expand file tree Collapse file tree 2 files changed +20
-7
lines changed Expand file tree Collapse file tree 2 files changed +20
-7
lines changed Original file line number Diff line number Diff line change @@ -2178,7 +2178,7 @@ const DefaultController = {
21782178 }
21792179 return Promise . resolve ( results ) ;
21802180 } ) ;
2181- } else {
2181+ } else if ( target instanceof ParseObject ) {
21822182 if ( ! target . id ) {
21832183 return Promise . reject ( new ParseError (
21842184 ParseError . MISSING_OBJECT_ID ,
@@ -2196,15 +2196,14 @@ const DefaultController = {
21962196 params ,
21972197 options
21982198 ) . 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 ) ;
22042202 await localDatastore . _updateObjectIfPinned ( target ) ;
22052203 return target ;
22062204 } ) ;
22072205 }
2206+ return Promise . resolve ( ) ;
22082207 } ,
22092208
22102209 async destroy ( target : ParseObject | Array < ParseObject > , options : RequestOptions ) : Promise < Array < void > | ParseObject > {
@@ -2278,7 +2277,6 @@ const DefaultController = {
22782277 return Promise . resolve ( target ) ;
22792278 } ) ;
22802279 }
2281- await localDatastore . _destroyObjectIfPinned ( target ) ;
22822280 return Promise . resolve ( target ) ;
22832281 } ,
22842282
Original file line number Diff line number Diff line change @@ -1257,6 +1257,21 @@ describe('ParseObject', () => {
12571257 expect ( controller . ajax ) . toHaveBeenCalledTimes ( 0 ) ;
12581258 } ) ;
12591259
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+
12601275 it ( 'fetchAll unique instance' , async ( ) => {
12611276 ParseObject . disableSingleInstance ( ) ;
12621277 const obj = new ParseObject ( 'Item' ) ;
You can’t perform that action at this time.
0 commit comments