Skip to content

Commit

Permalink
Use shallow merge in res.view (re #3500)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikermcneil committed Jan 18, 2016
1 parent 6f35bad commit 5861f65
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/hooks/views/res.view.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

1 comment on commit 5861f65

@sgress454
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After reading all through #3500 I'm not sure this is actually necessary. We should make a test to be sure, although it's tricky to even tell what the failing case would be. Like you said, we never explicitly documented that this was a merge, but if we don't need to change it, might as well just document the way it currently works rather than making a breaking change.

Please sign in to comment.