"Error: Element type is invalid" when using ReferenceInput inside CreateGusser
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- react, typescript
- 领域
- frontend
调研方向
首先,使用 issue 中的示例,通过一个 InputGuesser 以及随后一个来自 react-admin 的 ReferenceInput,重现报告的 CreateGuesser 案例。跟踪 CreateGuesser 如何渲染其子元素,并确定 ReferenceInput 被视为无效元素的原因。当引用输入能够在不出现所报告错误的情况下渲染,并且现有的创建字段继续正常工作时,即视为完成。
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- TypeScript
- 星标
- 516
- 派生
- 134
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
api-platform/admin 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 65/100
api-platform/admin#616 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 64/100
api-platform/admin#660 ·
-
难度 4/5 3-5 天 新手友好度 50/100
api-platform/admin#659 · 1 个 reaction ·
-
难度 3/5 1-2 天 新手友好度 35/100
api-platform/admin#631 · 6 条评论 ·
-
难度 4/5 3-5 天 新手友好度 35/100
api-platform/admin#626 · 1 条评论 · 1 个 reaction ·
查看 api-platform/admin 的全部 Issue
相似的 Issue
-
blocklist removal
难度 2/5 1-3 小时 新手友好度 65/100
MetaMask/eth-phishing-detect#296544 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
pastelsky/bundlephobia#1122 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
-
category/development priority/P2 scope/file-operations scope/testing type/enhancement
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 75/100