Opened 6 years ago

Closed 5 years ago

#16158 closed defect (fixed)

[patch] Invalid 'in' operand, using Cache with JsonRest PUT

Reported by: nosuchluke Owned by: Kris Zyp
Priority: high Milestone: 1.10
Component: Data Version: 1.8.1
Keywords: Cc:
Blocked By: Blocking:

Description

var store = new Cache(new JsonRest({ target: "/stuff" }), new Memory());
store.put({id:1}).then(null, function(err){alert(err);});

Result:

TypeError: invalid 'in' operand _7

This seems to result when the PUT returns a 204 or no-content 200, which is correct REST behavior. The result from JsonRest.put() is null, then in Cache we get to:

cachingStore.put(typeof result == "object" ? result : object, directives);

Since null is of type object, null gets passed to Memory, which then vomits in disgust.

Someone else encountered the problem here.

Change History (7)

comment:1 Changed 6 years ago by bill

Component: GeneralData
Owner: set to Kris Zyp

comment:2 Changed 6 years ago by Kris Zyp

Resolution: fixed
Status: newclosed

In [29843]:

Check for objects with a truthy clause to avoid nulls, fixes #16158

comment:3 Changed 6 years ago by bill

Milestone: tbd1.9

comment:4 Changed 5 years ago by dylan

Milestone: 1.91.10
Resolution: fixed
Status: closedreopened

comment:5 Changed 5 years ago by dylan

Summary: Invalid 'in' operand, using Cache with JsonRest PUT[patch] Invalid 'in' operand, using Cache with JsonRest PUT

Fix is trivial, so no CLA needed.

comment:6 Changed 5 years ago by Kris Zyp

Priority: undecidedhigh

comment:7 Changed 5 years ago by Kris Zyp <kriszyp@…>

Resolution: fixed
Status: reopenedclosed

In 9b974ae1d7c53879676d818025b16b7a8d2874fd/dojo:

Error: Processor CommitTicketReference failed
Unsupported version control system "git": Can't find an appropriate component, maybe the corresponding plugin was not enabled? 
Note: See TracTickets for help on using tickets.