Opened 7 years ago

Closed 6 years ago

#15518 closed defect (duplicate)

[patch] [cla] store.cache: checking for option.isLoaded, which might be undefined

Reported by: Simon Speich Owned by: Kris Zyp
Priority: undecided Milestone: tbd
Component: Data Version: 1.7.2
Keywords: Cc:
Blocked By: Blocking:

Description

Cache.query() checks for options.isLoaded property, but does not check if option argument exists at all (option argument is optional) on line 15 in Cache.js e.g.:

// but options is optional and might be undefined
if(!options.isLoaded || options.isLoaded(object))){ 

//should probably be
if(!options || (!options.isLoaded || options.isLoaded(object))){

Attachments (1)

Cache_options.patch (434 bytes) - added by Kitson Kelly 7 years ago.
Fixes options when not passed

Download all attachments as: .zip

Change History (4)

comment:1 Changed 7 years ago by Kitson Kelly

Owner: set to Kris Zyp
Status: newassigned

I just ran across this too...

Examples seem to indicate it is an optional argument, but it appears to not accept it.

A better solution might be:

var Cache = function(masterStore, cachingStore, options){
  options = options || {};
  return lang.delegate(masterStore, {
    // ...
  });
};

I have attached a patch to that affect.

Changed 7 years ago by Kitson Kelly

Attachment: Cache_options.patch added

Fixes options when not passed

comment:2 Changed 7 years ago by bill

Component: CoreData
Summary: store.cache: checking for option.isLoaded, which might be undefined[patch] [cla] store.cache: checking for option.isLoaded, which might be undefined

comment:3 Changed 6 years ago by Kris Zyp

Resolution: duplicate
Status: assignedclosed

Duplicate of #15845.

Note: See TracTickets for help on using tickets.