Skip to content

Commit 23a058e

Browse files
rayrutjesznck
authored andcommitted
fix(inject): change warn message when trying to mutate an injected value (vuejs#5243)
1 parent 7dea9f1 commit 23a058e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/core/instance/inject.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ export function initInjections (vm: Component) {
3434
if (process.env.NODE_ENV !== 'production') {
3535
defineReactive(vm, key, source._provided[provideKey], () => {
3636
warn(
37-
`Avoid mutating a injections directly since the value will be ` +
37+
`Avoid mutating an injected value directly since the changes will be ` +
3838
`overwritten whenever the provided component re-renders. ` +
39-
`injections being mutated: "${key}"`,
39+
`injection being mutated: "${key}"`,
4040
vm
4141
)
4242
})

test/unit/features/options/inject.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,8 @@ describe('Options provide/inject', () => {
213213
expect(child.foo).toBe(1)
214214
child.foo = 2
215215
expect(
216-
`Avoid mutating a injections directly since the value will be ` +
216+
`Avoid mutating an injected value directly since the changes will be ` +
217217
`overwritten whenever the provided component re-renders. ` +
218-
`injections being mutated: "${key}"`).toHaveBeenWarned()
218+
`injection being mutated: "${key}"`).toHaveBeenWarned()
219219
})
220220
})

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy