Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generateComponent dont update elementType on mapping elements #899

Open
Julia-Alberici opened this issue Apr 2, 2024 · 0 comments
Open

Comments

@Julia-Alberici
Copy link

eg. use case:

I have an uidl that has elements with elementType: group and when I use this uidl to generate a component I want to map this elementType to Fragment.
Now, I thought this was possible through mappings but I think there's an issue:
In resolveElement originalElement.semanticType has precedence on mappedElement.elementType wich is ok, but what I don't understand is, resolveElement is called in resolveNode wich is called in resolveUIDL after setFriendlyOutputOptions that will add a default semanticType to the element, so when it go to resolveElement the element will always have a semanticType.

Is this a bug? Or is just the expected behaviour to not replace the elementType on generateComponent flow?

Here's the sandbox of the example above https://codesandbox.io/p/sandbox/custom-component-generator-forked-rcz39t?file=%2Fsrc%2Findex.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant