@@ -54,30 +54,35 @@ const createProxyComponent = (
5454 }
5555
5656 const i = getCurrentInstance ( )
57- if ( typeof type === 'function' ) {
58- type = new Proxy ( type , {
59- apply ( target , ctx , args ) {
60- // @ts -ignore
61- if ( typeof target . __setup === 'function' ) {
57+ // @ts -ignore
58+ if ( ! type . __proxyed ) {
59+ if ( typeof type === 'function' ) {
60+ type = new Proxy ( type , {
61+ apply ( target , ctx , args ) {
6262 // @ts -ignore
63- target . __setup . apply ( ctx , args )
64- }
65- return normalizeNode ( Reflect . apply ( target , ctx , args ) )
66- } ,
67- get ( target , p , receiver ) {
68- if ( ( i && ( i . appContext as any ) ) . vapor && p === '__vapor' ) {
69- return true
70- }
71- return Reflect . get ( target , p , receiver )
72- } ,
73- } )
74- } else if ( type . __vapor && type . setup ) {
75- type . setup = new Proxy ( type . setup , {
76- apply ( target , ctx , args ) {
77- return normalizeNode ( Reflect . apply ( target , ctx , args ) )
78- } ,
79- } )
63+ if ( typeof target . __setup === 'function' ) {
64+ // @ts -ignore
65+ target . __setup . apply ( ctx , args )
66+ }
67+ return normalizeNode ( Reflect . apply ( target , ctx , args ) )
68+ } ,
69+ get ( target , p , receiver ) {
70+ if ( ( i && ( i . appContext as any ) ) . vapor && p === '__vapor' ) {
71+ return true
72+ }
73+ return Reflect . get ( target , p , receiver )
74+ } ,
75+ } )
76+ } else if ( type . __vapor && type . setup ) {
77+ type . setup = new Proxy ( type . setup , {
78+ apply ( target , ctx , args ) {
79+ return Reflect . apply ( target , ctx , args )
80+ } ,
81+ } )
82+ }
8083 }
84+ // @ts -ignore
85+ type . __proxyed = true
8186
8287 return createComponent ( type as VaporComponent , props , ...args )
8388}
0 commit comments