Skip to content

Commit bd8ce25

Browse files
committed
fix: issue with angular
1 parent 37810a4 commit bd8ce25

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

packages/components/src/components/accordion-item/accordion-item.lite.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import {
66
useDefaultProps,
77
useMetadata,
88
useRef,
9-
useStore
9+
useStore,
10+
useTarget
1011
} from '@builder.io/mitosis';
1112
import { DBAccordionItemProps, DBAccordionItemState } from './model';
1213
import { cls, getBooleanAsString, uuid } from '../../utils';
@@ -28,11 +29,11 @@ export default function DBAccordionItem(props: DBAccordionItemProps) {
2829
handleNameAttribute: () => {
2930
if (_ref) {
3031
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') {
3334
state._name = value;
3435
} else {
35-
return setAttribute.call(_ref, name, value);
36+
return setAttribute.call(_ref, attribute, value);
3637
}
3738
};
3839
}
@@ -59,7 +60,7 @@ export default function DBAccordionItem(props: DBAccordionItemProps) {
5960

6061
onUpdate(() => {
6162
if (_ref && state.initialized) {
62-
state.handleNameAttribute();
63+
useTarget({ react: () => state.handleNameAttribute() });
6364
}
6465
}, [_ref, state.initialized]);
6566

packages/components/src/components/tab-item/tab-item.lite.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ export default function DBTabItem(props: DBTabItemProps) {
3232
handleNameAttribute: () => {
3333
if (_ref) {
3434
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') {
3737
state._name = value;
3838
} else {
39-
return setAttribute.call(_ref, name, value);
39+
return setAttribute.call(_ref, attribute, value);
4040
}
4141
};
4242
}
@@ -79,9 +79,9 @@ export default function DBTabItem(props: DBTabItemProps) {
7979
if (state.initialized && _ref) {
8080
if (props.active) {
8181
_ref.click();
82-
83-
state.handleNameAttribute();
8482
}
83+
84+
useTarget({ react: () => state.handleNameAttribute() });
8585
state.initialized = false;
8686
}
8787
}, [_ref, state.initialized]);

0 commit comments

Comments
 (0)