userCache icon indicating copy to clipboard operation
userCache copied to clipboard

Ignores the cache if required field exists but is falsy

Open wildhart opened this issue 5 years ago • 0 comments

The return value of _getField() is usually defined by:

		if (!doc[field[i]]) {
			return; // === undefined
		}

and then the existance of the field is determined by:

if (typeof _getField(cache, item) === "undefined") {
  innocent = false;
}}

This will cause the cache to be missed if a required field exists but is falsy. E.g.:

doc = {admin: false}; // or null fails as well
field = 'admin';
_getField(doc, field); // undefined, the cache will be ignored :-(

wildhart avatar Feb 07 '20 04:02 wildhart