Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cache also undefined values in option resolver #9661

Merged
merged 1 commit into from Oct 4, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 5 additions & 9 deletions src/helpers/helpers.config.js
Expand Up @@ -181,17 +181,13 @@ const readKey = (prefix, name) => prefix ? prefix + _capitalize(name) : name;
const needsSubResolver = (prop, value) => isObject(value) && prop !== 'adapters';

function _cached(target, prop, resolve) {
let value = target[prop]; // cached value
if (defined(value)) {
return value;
if (Object.prototype.hasOwnProperty.call(target, prop)) {
return target[prop];
}

value = resolve();

if (defined(value)) {
// cache the resolved value
target[prop] = value;
}
const value = resolve();
// cache the resolved value
target[prop] = value;
return value;
}

Expand Down