Skip to content

generateComponent dont update elementType on mapping elements #899

Open
@Julia-Alberici

Description

@Julia-Alberici

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions