Skip to content

Commit

Permalink
Merge pull request #149 from queckezz/fix_state
Browse files Browse the repository at this point in the history
feat(#113): improve locals priority
  • Loading branch information
int64ago committed Dec 3, 2020
2 parents a820930 + 7b692e0 commit 1d6de4c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function viewsMiddleware(

return getPaths(path, relPath, extension).then(paths => {
const suffix = paths.ext
const state = Object.assign(locals, options, ctx.state || {})
const state = Object.assign({}, options, ctx.state || {}, locals)
// deep copy partials
state.partials = Object.assign(Object.create(null), options.partials || {})
if (debug.enabled) debug('render `%s` with %s', paths.rel, JSON.stringify(state, bigIntReplacer()))
Expand Down

0 comments on commit 1d6de4c

Please sign in to comment.