siemens / ix-icons

Icon library for @siemens/ix
MIT License
26 stars 5 forks source link

resolveIcon(icon) function errors with undefined when IxChip component is used without icon attribute #34

Closed soundararaj-gayathri closed 11 months ago

soundararaj-gayathri commented 1 year ago

I'm submitting a...


[x] Bug report
[ ] Feature request
[ ] Documentation issue or request

Current behavior

Using siemens IxChip component without icon attributes causes src and name to be undefined. Hence, we get a error dumped to the console. icon-21211f80.js:6 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'startsWith') at isSvgDataUrl (icon-21211f80.js:6:1) at resolveIcon (icon-21211f80.js:44:1) at Icon.loadIconContent (icon-21211f80.js:63:1) at Icon.connectedCallback (icon-21211f80.js:60:1) at safeCall (index-8ddfb6d8.js:1515:1) at fireConnectedCallback (index-8ddfb6d8.js:1762:1) at initializeComponent (index-8ddfb6d8.js:1732:1) at connectedCallback (index-8ddfb6d8.js:1812:1) at index-8ddfb6d8.js:2051:1 at Object.jmp (index-8ddfb6d8.js:2379:1)

Expected behavior

IxChip component should be usable without icon attribute

Minimal reproduction of the problem with instructions

Insert the below line on any react component <IxChip>123</IxChip>

Insert the below line on any react component <IxChip>123</IxChip>

What is the motivation / use case for changing the behavior?

danielleroux commented 1 year ago

Which version of ix-icons do you use. Should be fixed in 1.1.1.

soundararaj-gayathri commented 1 year ago

@danielleroux I am using "@siemens/ix": "^1.6.1", "@siemens/ix-aggrid": "^1.6.1", "@siemens/ix-brand-theme": "^1.2.0", "@siemens/ix-icons": "^1.1.1", "@siemens/ix-react": "^1.6.1",

danielleroux commented 1 year ago

@danielleroux I am using "@siemens/ix": "^1.6.1", "@siemens/ix-aggrid": "^1.6.1", "@siemens/ix-brand-theme": "^1.2.0", "@siemens/ix-icons": "^1.1.1", "@siemens/ix-react": "^1.6.1",

Iam not able to repduce with 1.1.1 can you provide some example code? (Stackblitz or similar)

danielleroux commented 1 year ago

@soundararaj-gayathri Looks like u are right there is still an issue regarding the startWith check. We have already a solution which requires a update to 1.6.2 of the ix library itself. I will close this issue if this version is released.

soundararaj-gayathri commented 1 year ago

@soundararaj-gayathri Looks like u are right there is still an issue regarding the startWith check. We have already a solution which requires a update to 1.6.2 of the ix library itself. I will close this issue if this version is released.

Okay. Thank you.