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

ReferenceManyCount renders a corrupted link #8750

Closed
riffbyte opened this issue Mar 22, 2023 · 6 comments · Fixed by #8752
Closed

ReferenceManyCount renders a corrupted link #8750

riffbyte opened this issue Mar 22, 2023 · 6 comments · Fixed by #8752
Labels

Comments

@riffbyte
Copy link
Contributor

riffbyte commented Mar 22, 2023

What you were expecting:
When used with link prop, ReferenceManyCount should render a clickable link that leads to the filtered resource page

What happened instead:
The link is rendered as span tag with to attribute set to [object Object].

Steps to reproduce:
It is actually reproducible on the simple example straight out of the box. Just click "inspect" on any "Nb comment" field in Posts grid.

Other information:
This is easily fixable by removing a single line:

I've filed a PR with the proposed change: #8752

I don't think using span was intended, probably just flowed over from Typography component props below.

Environment

  • React-admin version: 4.6.2
  • React version: 18.2.0
  • Browser: Chrome
@riffbyte riffbyte changed the title ReferenceManyCount renders link as a span ReferenceManyCount renders a corrupted link Mar 22, 2023
@slax57 slax57 added the bug label Mar 22, 2023
@slax57
Copy link
Contributor

slax57 commented Mar 22, 2023

Reproduced, thanks!

@slax57
Copy link
Contributor

slax57 commented Mar 22, 2023

Sorry @oleg-semyonov I did not see you had already opened a PR for this issue.
Mine has the advantage of allowing to remove the // @ts-ignore for good so I'd recommend keeping this one over yours.
Still grateful for the report and the PR though! 🙏

@riffbyte
Copy link
Contributor Author

Wow, thanks for such a quick response!

I checked your PR, and indeed that's a much more permanent solution. I closed my PR in favor of yours.

@slax57
Copy link
Contributor

slax57 commented Mar 22, 2023

@oleg-semyonov plot twist: #8754 (comment) actually gives arguments in favor of your PR 😁
Would you like to reopen it? (seems like I can't do it myself)
Sorry for the time loss 😅

@riffbyte
Copy link
Contributor Author

Re-opened the PR! Please check my solution for the @ts-ignore directive. It might be a breaking change as well, but it seems to me that the way I did is what it supposed to be in the first place 🤔

@slax57
Copy link
Contributor

slax57 commented Mar 22, 2023

It looks good to me, thanks!

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