File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -627,7 +627,7 @@ describe('api: options', () => {
627627 render ( h ( Comp ) , root )
628628 instance . foo = 1
629629 expect (
630- 'Computed property "foo" was assigned to but it has no setter. '
630+ 'Write operation failed: computed property "foo" is readonly '
631631 ) . toHaveBeenWarned ( )
632632 } )
633633
Original file line number Diff line number Diff line change @@ -40,7 +40,8 @@ import {
4040 reactive ,
4141 ComputedGetter ,
4242 WritableComputedOptions ,
43- ComputedRef
43+ ComputedRef ,
44+ toRaw
4445} from '@vue/reactivity'
4546import {
4647 ComponentObjectPropsOptions ,
@@ -276,11 +277,12 @@ export function applyOptions(
276277 errorCaptured
277278 } = options
278279
279- const renderContext =
280+ const renderContext = toRaw (
280281 instance . renderContext === EMPTY_OBJ &&
281282 ( computedOptions || methods || watchOptions || injectOptions )
282283 ? ( instance . renderContext = reactive ( { } ) )
283284 : instance . renderContext
285+ )
284286
285287 const globalMixins = instance . appContext . mixins
286288 // call it only during dev
@@ -355,7 +357,7 @@ export function applyOptions(
355357 : __DEV__
356358 ? ( ) => {
357359 warn (
358- `Computed property "${ key } " was assigned to but it has no setter .`
360+ `Write operation failed: computed property "${ key } " is readonly .`
359361 )
360362 }
361363 : NOOP
@@ -369,7 +371,9 @@ export function applyOptions(
369371 if ( renderContext [ key ] && ! ( key in proxyTarget ) ) {
370372 Object . defineProperty ( proxyTarget , key , {
371373 enumerable : true ,
372- get : ( ) => ( renderContext [ key ] as ComputedRef ) . value
374+ configurable : true ,
375+ get : ( ) => ( renderContext [ key ] as ComputedRef ) . value ,
376+ set : NOOP
373377 } )
374378 }
375379 }
You can’t perform that action at this time.
0 commit comments