Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Too many requests when clicking on a resource for the first time or initially

Open
#582 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
react, typescript
Domain
api, frontend

Research direction

Start by reproducing the first resource click or page reload with the provided HydraAdmin, hydraDataProvider, custom httpClient, and apiDocumentationParser setup, then inspect the browser network trace. Trace the initial requests through the data provider and frontend entry points; done means the initial resource load no longer fires unexplained duplicate requests in development or production.

Written by the indexing model from the issue text.

Description

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

Bildschirmfoto 2024-09-13 um 10 54 09

Prod Mode

Bildschirmfoto 2024-09-13 um 11 04 05

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

Dominant language
TypeScript
Stars
516
Forks
134
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from api-platform/admin

All issues in api-platform/admin

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.