File tree Expand file tree Collapse file tree 2 files changed +11
-10
lines changed
packages/components/src/components Expand file tree Collapse file tree 2 files changed +11
-10
lines changed Original file line number Diff line number Diff line change 6
6
useDefaultProps ,
7
7
useMetadata ,
8
8
useRef ,
9
- useStore
9
+ useStore ,
10
+ useTarget
10
11
} from '@builder.io/mitosis' ;
11
12
import { DBAccordionItemProps , DBAccordionItemState } from './model' ;
12
13
import { cls , getBooleanAsString , uuid } from '../../utils' ;
@@ -28,11 +29,11 @@ export default function DBAccordionItem(props: DBAccordionItemProps) {
28
29
handleNameAttribute : ( ) => {
29
30
if ( _ref ) {
30
31
const setAttribute = _ref . setAttribute ;
31
- _ref . setAttribute = function ( name : string , value : string ) {
32
- if ( name === 'name' ) {
32
+ _ref . setAttribute = ( attribute : string , value : string ) => {
33
+ if ( attribute === 'name' ) {
33
34
state . _name = value ;
34
35
} else {
35
- return setAttribute . call ( _ref , name , value ) ;
36
+ return setAttribute . call ( _ref , attribute , value ) ;
36
37
}
37
38
} ;
38
39
}
@@ -59,7 +60,7 @@ export default function DBAccordionItem(props: DBAccordionItemProps) {
59
60
60
61
onUpdate ( ( ) => {
61
62
if ( _ref && state . initialized ) {
62
- state . handleNameAttribute ( ) ;
63
+ useTarget ( { react : ( ) => state . handleNameAttribute ( ) } ) ;
63
64
}
64
65
} , [ _ref , state . initialized ] ) ;
65
66
Original file line number Diff line number Diff line change @@ -32,11 +32,11 @@ export default function DBTabItem(props: DBTabItemProps) {
32
32
handleNameAttribute : ( ) => {
33
33
if ( _ref ) {
34
34
const setAttribute = _ref . setAttribute ;
35
- _ref . setAttribute = function ( name : string , value : string ) {
36
- if ( name === 'name' ) {
35
+ _ref . setAttribute = ( attribute : string , value : string ) => {
36
+ if ( attribute === 'name' ) {
37
37
state . _name = value ;
38
38
} else {
39
- return setAttribute . call ( _ref , name , value ) ;
39
+ return setAttribute . call ( _ref , attribute , value ) ;
40
40
}
41
41
} ;
42
42
}
@@ -79,9 +79,9 @@ export default function DBTabItem(props: DBTabItemProps) {
79
79
if ( state . initialized && _ref ) {
80
80
if ( props . active ) {
81
81
_ref . click ( ) ;
82
-
83
- state . handleNameAttribute ( ) ;
84
82
}
83
+
84
+ useTarget ( { react : ( ) => state . handleNameAttribute ( ) } ) ;
85
85
state . initialized = false ;
86
86
}
87
87
} , [ _ref , state . initialized ] ) ;
You can’t perform that action at this time.
0 commit comments