Skip to content

Commit

Permalink
fix(inject): change warn message when trying to mutate an injected va…
Browse files Browse the repository at this point in the history
…lue (vuejs#5243)
  • Loading branch information
rayrutjes authored and awamwang committed Jun 15, 2017
1 parent 61f42e5 commit 3ae332b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/core/instance/inject.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ export function initInjections (vm: Component) {
if (process.env.NODE_ENV !== 'production') {
defineReactive(vm, key, source._provided[provideKey], () => {
warn(
`Avoid mutating a injections directly since the value will be ` +
`Avoid mutating an injected value directly since the changes will be ` +
`overwritten whenever the provided component re-renders. ` +
`injections being mutated: "${key}"`,
`injection being mutated: "${key}"`,
vm
)
})
Expand Down
4 changes: 2 additions & 2 deletions test/unit/features/options/inject.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ describe('Options provide/inject', () => {
expect(child.foo).toBe(1)
child.foo = 2
expect(
`Avoid mutating a injections directly since the value will be ` +
`Avoid mutating an injected value directly since the changes will be ` +
`overwritten whenever the provided component re-renders. ` +
`injections being mutated: "${key}"`).toHaveBeenWarned()
`injection being mutated: "${key}"`).toHaveBeenWarned()
})
})

0 comments on commit 3ae332b

Please sign in to comment.