"Error: Element type is invalid" when using ReferenceInput inside CreateGusser
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- react, typescript
- Domain
- frontend
Research direction
Start by reproducing the reported CreateGuesser case with an InputGuesser and then a ReferenceInput from react-admin, using the example in the issue. Trace how CreateGuesser renders its children and identify why ReferenceInput is treated as an invalid element. Done means the reference input renders without the reported error and the existing create fields continue to work.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- TypeScript
- Stars
- 516
- Forks
- 134
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from api-platform/admin
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
api-platform/admin#616 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 64/100
api-platform/admin#660 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 50/100
api-platform/admin#659 · 1 reaction ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
api-platform/admin#631 · 6 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
api-platform/admin#626 · 1 comment · 1 reaction ·
All issues in api-platform/admin
Similar issues
-
clawsweeper:linked-pr-open clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:message-loss issue-rating: 🦞 diamond lobster maturity:stable P2
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#616 ·
-
ZCode 3.14.3 に対応する Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
supermomonga/zcode-acp#24 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
growthbook/growthbook#7100 ·
-
triage
Difficulty 1/5 1-3 hours Newbie friendliness 88/100