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

FieldGuesser: props passing to SingleFieldList (linkType prop) #495

Merged

Conversation

PawelSuwinski
Copy link
Contributor

@PawelSuwinski PawelSuwinski commented Feb 13, 2023

By default any reference field links to edit view.

To change it RA uses link prop for single field and linkType prop for array.

So that works fine:

<FieldGuesser source={"user"} link={"show"} />

But for array it doesn't because nested SimpeFieldList component does't get its prop:

<FieldGuesser source={"users"} linkType={"show"} />

So the only solution for that is to skip using FieldGuesser for arrays and write it by hand.

IHMO it is good to unify that and support it in both cases by FieldGuesser especially that it is very common use case to have all relations linked to show pages.

@PawelSuwinski PawelSuwinski force-pushed the ReferenceArrayField_linkType branch from e50f3a8 to 424386a Compare February 13, 2023 11:59
src/FieldGuesser.tsx Outdated Show resolved Hide resolved
@alanpoulain
Copy link
Member

CI seems to fail, I need some time to dig the issue, feel free to do it if you want 🙂

@PawelSuwinski PawelSuwinski force-pushed the ReferenceArrayField_linkType branch from 424386a to 35ad8c7 Compare February 13, 2023 17:02
@PawelSuwinski
Copy link
Contributor Author

Checks solved, so what about merging it?

@dunglas dunglas merged commit 295369b into api-platform:main Mar 6, 2024
1 check passed
@dunglas
Copy link
Member

dunglas commented Mar 6, 2024

Thank you!

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

Successfully merging this pull request may close these issues.

3 participants