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

"Error: Element type is invalid" when using ReferenceInput inside CreateGusser #591

Open
modiamir opened this issue Dec 23, 2024 · 0 comments

Comments

@modiamir
Copy link

API Platform version(s) affected: 4.0.3

Description
I have a resource named categories which has a CreateCategory component to define its create fields like this:

import {
  CreateGuesser,
  InputGuesser,
} from '@api-platform/admin';

const CreateCategory = (props: any) => (
  <CreateGuesser {...props}>
    <InputGuesser source="title" />
    <InputGuesser source="parent" />
  </CreateGuesser>
);

export default CreateCategory;

It's working properly but when I want to customize parent field by using ReferenceField like this:

import {
  CreateGuesser,
  InputGuesser,
} from '@api-platform/admin';
import { ReferenceInput } from "react-admin";

const CreateCategory = (props: any) => (
  <CreateGuesser {...props}>
    <InputGuesser source="title" />
    <ReferenceInput source="parent" reference="categories" />
  </CreateGuesser>
);

export default CreateCategory;

I am getting error:

Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.

Check the render method of `Error3`.
    at createFiberFromTypeAndProps (http://localhost:5173/node_modules/.vite/deps/chunk-ICOORQWA.js?v=5322f6b5:20471:25)
    at createFiberFromElement (http://localhost:5173/node_modules/.vite/deps/chunk-ICOORQWA.js?v=5322f6b5:20492:23)
    at reconcileSingleElement (http://localhost:5173/node_modules/.vite/deps/chunk-ICOORQWA.js?v=5322f6b5:10531:31)
    at reconcileChildFibers2 (http://localhost:5173/node_modules/.vite/deps/chunk-ICOORQWA.js?v=5322f6b5:10568:43)
    at reconcileChildren (http://localhost:5173/node_modules/.vite/deps/chunk-ICOORQWA.js?v=5322f6b5:14310:37)
    at updateHostComponent (http://localhost:5173/node_modules/.vite/deps/chunk-ICOORQWA.js?v=5322f6b5:14827:11)
    at beginWork (http://localhost:5173/node_modules/.vite/deps/chunk-ICOORQWA.js?v=5322f6b5:15955:22)
    at beginWork$1 (http://localhost:5173/node_modules/.vite/deps/chunk-ICOORQWA.js?v=5322f6b5:19781:22)
    at performUnitOfWork (http://localhost:5173/node_modules/.vite/deps/chunk-ICOORQWA.js?v=5322f6b5:19226:20)
    at workLoopSync (http://localhost:5173/node_modules/.vite/deps/chunk-ICOORQWA.js?v=5322f6b5:19165:13)

How to reproduce
The way of reproducing is already explained in the description.

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