File tree 1 file changed +18
-2
lines changed
packages/runtime-core/src
1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ import {
17
17
ClassComponent
18
18
} from './component'
19
19
import { RawSlots } from './componentSlots'
20
- import { isReactive , Ref } from '@vue/reactivity'
20
+ import { isReactive , Ref , toRaw } from '@vue/reactivity'
21
21
import { AppContext } from './apiCreateApp'
22
22
import {
23
23
SuspenseImpl ,
@@ -236,7 +236,7 @@ const createVNodeWithArgsTransform = (
236
236
237
237
export const InternalObjectSymbol = Symbol ( )
238
238
239
- export const createVNode = ( __DEV__
239
+ export const createVNode = ( false
240
240
? createVNodeWithArgsTransform
241
241
: _createVNode ) as typeof _createVNode
242
242
@@ -292,6 +292,22 @@ function _createVNode(
292
292
? ShapeFlags . FUNCTIONAL_COMPONENT
293
293
: 0
294
294
295
+ if (
296
+ __DEV__ &&
297
+ shapeFlag & ShapeFlags . STATEFUL_COMPONENT &&
298
+ isReactive ( type )
299
+ ) {
300
+ type = toRaw ( type )
301
+ warn (
302
+ `Vue received a Component which was made a reactive object. This can ` +
303
+ `lead to unnecessary performance overhead, and should be avoided by ` +
304
+ `marking the component with \`markNonReactive\` or using \`shallowRef\` ` +
305
+ `instead of \`ref\`.` ,
306
+ `\nComponent that was made reactive: ` ,
307
+ type
308
+ )
309
+ }
310
+
295
311
const vnode : VNode = {
296
312
_isVNode : true ,
297
313
type,
You can’t perform that action at this time.
0 commit comments