Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicated requests to API without pagination parameters #508

Open
byfareska opened this issue Oct 1, 2023 · 3 comments
Open

Duplicated requests to API without pagination parameters #508

byfareska opened this issue Oct 1, 2023 · 3 comments
Labels

Comments

@byfareska
Copy link

byfareska commented Oct 1, 2023

API Platform version(s) affected: 3.1.15, react admin 3.4.4

Description
Duplicated requests to API without pagination parameters on page load, menu usage or pagination.

How to reproduce
I've just pasted the index.js file from docs

import React from 'react';
import ReactDOM from 'react-dom';
import {
    AdminGuesser,
    hydraDataProvider,
    hydraSchemaAnalyzer,
} from '@api-platform/admin';

// Use your custom data provider or resource schema analyzer
// Hydra:
const dataProvider = hydraDataProvider({ entrypoint: 'http://localhost:63305' });
const schemaAnalyzer = hydraSchemaAnalyzer();
// OpenAPI:

const Admin = () => (
    <AdminGuesser
        dataProvider={dataProvider}
        schemaAnalyzer={schemaAnalyzer}
    />
);

ReactDOM.render(<Admin />, document.getElementById('root'));

Edit: the problem is also visible on official app skeleton https://github.com/api-platform/api-platform/tree/v3.1.14
Additional Context
You can see these requests on this video: https://streamable.com/1pfy9s

@fzaninotto
Copy link
Contributor

Reproduced. These requests seem to be necessary for introspection.

@fzaninotto fzaninotto added the bug label Jul 27, 2024
@fzaninotto
Copy link
Contributor

The problem comes from @api-platform/api-doc-parser. To introspect the parameters of a resource, the Hydra parser has to fetch the getList route:

https://github.com/api-platform/api-doc-parser/blob/e8b49f2b452c4a19fab5eea86ec742c8201d381f/src/hydra/getParameters.ts#L1-L26

It should be possible to use the main schema instead

@fzaninotto
Copy link
Contributor

Probably linked to api-platform/api-doc-parser#115

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants