From 57ade9e5df11976475cdf17ca921aca3046a5e3a Mon Sep 17 00:00:00 2001 From: Mike McNeil Date: Mon, 18 Jan 2016 15:19:11 -0600 Subject: [PATCH] Use shallow merge in res.view (re https://github.com/balderdashy/sails/issues/3500) --- lib/hooks/views/res.view.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/hooks/views/res.view.js b/lib/hooks/views/res.view.js index 794e4f7fcb..95fccc8799 100644 --- a/lib/hooks/views/res.view.js +++ b/lib/hooks/views/res.view.js @@ -150,7 +150,9 @@ module.exports = function _addResViewMethod(req, res, next) { // Merge with config views locals if (sails.config.views.locals) { - _.merge(locals, sails.config.views.locals, _.defaults); + // Formerly a deep merge: `_.merge(locals, sails.config.views.locals, _.defaults);` + // Now shallow- see https://github.com/balderdashy/sails/issues/3500 + _.defaults(locals, sails.config.views.locals); } // If the path was specified, but invalid