Too many requests when clicking on a resource for the first time or initially
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- react, typescript
调研方向
首先,使用提供的 HydraAdmin、hydraDataProvider、自定义 httpClient 和 apiDocumentationParser 设置,重现第一次资源点击或页面重新加载,然后检查浏览器网络跟踪。通过数据提供程序和前端入口跟踪初始请求;完成的标准是,初始资源加载在开发或生产环境中不再触发无法解释的重复请求。
由索引模型根据 Issue 内容生成。
描述
API Platform version(s) affected: x.y.z
Backend
v3.3.12
Frontend
"@api-platform/admin": "^4.0.1",
Description
When I click on a resource for the first time a lot of requests will fire. Here I reload the page on a specific resource (http://localhost:3000/#/locations). We also tested in prod mode.
Dev Mode
Prod Mode
How to reproduce
Its a simple example. I just use a custom httpClient to set a header for the authorization (jwt).
import { HydraAdmin, hydraDataProvider } from "@api-platform/admin";
import { parseHydraDocumentation } from "@api-platform/api-doc-parser";
import { ENTRYPOINT } from "./constants/entrypoint";
import MyHeaders from "./constants/headers";
import httpClient from "./components/HttpClient";
// Replace with your own API entrypoint
// For instance if https://example.com/api/books is the path to the collection of book resources, then the entrypoint is https://example.com/api
const apiDocumentationParser = () => async () => {
try {
return await parseHydraDocumentation(ENTRYPOINT, {
headers: MyHeaders
});
} catch (result) {
// @ts-ignore
const { api, response, status } = result;
if (status !== 401 || !response) {
throw result;
}
return {
api,
response,
status,
};
}
};
const dataProvider = hydraDataProvider({
entrypoint: ENTRYPOINT,
httpClient: httpClient,
apiDocumentationParser: apiDocumentationParser(),
useEmbedded: false,
});
export default () => (
<HydraAdmin dataProvider={dataProvider} />
);
Additional Context
- 主要语言
- 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
-
难度 2/5 1-3 小时 新手友好度 84/100
bcgov/bc-wallet-mobile#4761 · 1 条评论 ·
-
external-issue to-triage
难度 2/5 1-3 小时 新手友好度 88/100
-
area-deployment area-integrations triage:bot-seen
难度 2/5 半天 新手友好度 86/100
-
难度 2/5 1-3 小时 新手友好度 82/100
-
refactor
难度 2/5 1-3 小时 新手友好度 84/100