Color Selector Custom Form Component Element Type Invalid Error

larsHoneytoast February 14, 2024 1:42 PM

[describe your problem or question]

---Hi All, I'm trying to get the provided ColorSelector form component working in XbyK Color Selector Documentation I was able to get everything set up. I can add the color selector as the Form component in a text field:

but when I add a new content item of that content type I get the following:

Content error message

With a console error that points to this react error: https://react.dev/errors/306?invariant=306&args%5B%5D=undefined&args%5B%5D=

Element type is invalid. Received a promise that resolves to: undefined.

Haven't worked with React much and followed the Xperience by Kentico documentation to get to this point. Any help in pointing me in the right direction is appreciated.

Environment

Answers

🔗 Liam Goldfinch (liamgold) February 14, 2024 3:11 PM

If you have the selector appearing in the list, it sounds like you've got the C# code done correctly for the component and you need to check the admin customisation project is set up correctly.

I would double check the organization/project name's match, in the webpack.config.js file, the csproj of the project that holds your admin c# code, and the class where you've called RegisterClientModule. All three need to match or the admin project may not load. Some documentation around this can be found here.

If they match, then I would maybe check you've definitely amended the entry point file, src/entry.tsx, you should add your component like this:

// Exposes components from the module. All added components need to be exported.
export * from "./components/ColorSelector/ColorSelectorFormComponent";

🔗 larsHoneytoast February 14, 2024 9:54 PM

Thanks Liam, that was it. I didn't have it added to the entry.tsx


🔗 Liam Goldfinch (liamgold) February 14, 2024 11:46 PM

I don't think the documentation really covers the entry point file - I might submit that as a recommendation to highlight more clearly.


To answer this question, you have to login first.