React generator has inconsistent paths generation
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 25/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- react, typescript
调研方向
运行文档中记录的 yarn build 和 testgen.sh react 命令,然后比较 tmp/react/routes/book.tsx 与 tmp/react/components/book/Show.tsx。追踪生成这些文件的生成器模板,并确定每个文件所使用的路径变量。当生成的路由路径和导航链接使用相同的资源路径时,即视为完成。
由索引模型根据 Issue 内容生成。
描述
Description
React generator has problem with paths for resources.
I generated a client using https://demo.api-platform.com/, while the generated routes have paths like /admin/books/create the Show components has paths like <Navigate to="/books/" replace />
How to reproduce
- Generate a client with
rm -rf ./tmp && yarn build && ENTRYPOINT=https://demo.api-platform.com/ ./testgen.sh react - Go to
tmp/react/routes/book.tsxyou will see
const routes = [
<Route path="/admin/books/create" element={<Create />} key="create" />,
<Route path="/admin/books/edit/:id" element={<Update />} key="update" />,
<Route path="/admin/books/show/:id" element={<Show />} key="show" />,
<Route path="/admin/books" element={<List />} key="list" />,
<Route path="/admin/books/:page" element={<List />} key="page" />,
];
- Go to
tmp/react/components/book/Show.tsxand you can see
<Link to="/books/" className="btn btn-primary">
Back to list
</Link>
Possible Solution
Use the same variable in all template when generating routes and links
Additional Context
PR here : https://github.com/api-platform/create-client/pull/377
- 主要语言
- TypeScript
- 星标
- 376
- 派生
- 133
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
api-platform/create-client 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 35/100
api-platform/create-client#396 ·
-
[potential Security Alert] New `test-nuxt-app` script added in `@api-platform/[email protected]`未关闭
难度 4/5 3-5 天 新手友好度 38/100
api-platform/create-client#397 ·
-
[potential Security Alert] New `test-next-app` script added in `@api-platform/[email protected]`未关闭
难度 3/5 1-2 天 新手友好度 45/100
api-platform/create-client#395 ·
-
[potential Security Alert] New `test-react-app` script added in `@api-platform/[email protected]`未关闭
难度 4/5 3-5 天 新手友好度 35/100
api-platform/create-client#394 ·
-
难度 4/5 3-5 天 新手友好度 25/100
api-platform/create-client#393 · 1 条评论 ·
查看 api-platform/create-client 的全部 Issue
相似的 Issue
-
Contrib indemnité de départ à la retraite : faire le pont avec le simulateur sur la page générique未关闭P1
难度 2/5 1-3 小时 新手友好度 62/100
SocialGouv/code-du-travail-numerique#7561 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
kubernetes-sigs/headlamp#7950 ·
维护者通常 3 天内回复
-
README for cli可能已有人在做 @Janvi-kapoor 今天认领。 未关闭OSCI'26
难度 2/5 1-3 小时 新手友好度 70/100
GauravKarakoti/SecureFlow#1308 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复
-
documentation
难度 2/5 1-3 小时 新手友好度 62/100
vitest-dev/vitest#11577 ·
维护者通常 1 天内回复