marmelab / react-admin

A frontend Framework for building data-driven applications running on top of REST/GraphQL APIs, using TypeScript, React and Material Design
http://marmelab.com/react-admin
MIT License
24.58k stars 5.21k forks source link

Incorrectly parse of id with basename name same as resource name #9906

Open Netail opened 1 month ago

Netail commented 1 month ago

What you were expecting: When a basename has been set in the <Admin> component and one of the resources has the same name as the basename, it should correctly parse the id for fetching getOne.

/sponsored-recipes/sponsored-recipes/1 should fetch with the following: { resource: "sponsored-recipes", id: "1" }

What happened instead: Instead it uses the resource name as id for fetching getOne.

/sponsored-recipes/sponsored-recipes/1 will try to fetch with the following: { resource: "sponsored-recipes", id: "sponsored-recipes" }

Steps to reproduce:

  1. Set a basepath with the same name as resource
  2. Open a detail page or even on list page already
  3. Check console

Related code: Haven't got time for a example yet, can add later if needed

Environment

fzaninotto commented 1 month ago

Yes, please add a reproducible example.