Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

<HydraAdmin/> page remain empty despite successful XHR requests

未关闭
#557 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
25/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
react, typescript
领域
api, frontend

调研方向

从包含 HydraAdmin 和 ResourceGuesser 的 React 页面开始,然后检查 dataProviders/dataProviderHydra 以及成功的 XHR 响应,以确认预期的 Hydra 集合结构。使用干净的 Symfony 6.4 设置和列出的版本进行复现;完成的标准是书籍和评论资源渲染出数据表,而不是空白页面。

由索引模型根据 Issue 内容生成。

描述

API Platform version(s) affected: 3.3.3

Description

Why does my page remain empty despite successful XHR requests?
Hello everyone again,
I'm working with a page that successfully fetches data according to XHR logs.

image

Here's the relevant part of my @context:

{
    "@context": {
        "@vocab": "http://www.semese.local/api/docs.jsonld#",
        "hydra": "http://www.w3.org/ns/hydra/core#",
        "error": { "@id": "Entrypoint/error", "@type": "@id" },
        "constraintViolationList": { "@id": "Entrypoint/constraintViolationList", "@type": "@id" },
        "book": { "@id": "Entrypoint/book", "@type": "@id" },
        "review": { "@id": "Entrypoint/review", "@type": "@id" }
    }
}

Despite this, the page remains blank. Adding and under redirects me to /book, but still displays nothing.

For reference, I'm trying to achieve a similar functionality as seen in the API Platform demo: API Platform Admin Demo

Why are the resources not displayed, and how can I troubleshoot or fix this issue to see the data tables like in the demo?

How to reproduce

 - started with a clean new symfony 6.4 project
 - created 2 entities in the entity folder of the symfony project
 - adjusted nelmio-cors to have no issues
 - created a react frontend with 
      "@api-platform/admin": "^3.4.7",
      "react": "^18.2.0",
      "react-admin": "^4.16.17",
      ... and, the following react page:
import React from 'react';
import {AdminGuesser, HydraAdmin, ResourceGuesser} from "@api-platform/admin";  // Importă authProvider-ul tău
import {dataProvider} from "../dataProviders/dataProviderHydra"
import {CustomRoutes} from "react-admin";

const entrypoint = 'http://sf4.local/api/index.jsonld';
const HydraAdminPage = () => {
    return (
        <HydraAdmin
            entrypoint={entrypoint}
            dataProvider={dataProvider}
        >
            <ResourceGuesser name="book" />
            <ResourceGuesser name="review" />
        </HydraAdmin>
    );
};
export default HydraAdminPage;

Possible Solution

Additional Context

same issue is happening for me with api platform 2.7.18...

主要语言
TypeScript
星标
516
派生
134
PR 合并指标
30 天内没有已合并 PR

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

api-platform/admin 的其他 Issue

查看 api-platform/admin 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。