Skip to content

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

Open

Description

@modiamir

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.

Activity

  1. guilbill commented on Feb 25, 2025

    @guilbill

    Can't reproduce, can you show us the way you define the relationship with Doctrine?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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