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

fix useUnique.ts #9891

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

alirezaCodeHub
Copy link

replace useRecordContext with useGetRecordId.
it's always has value

replace useRecordContext with useGetRecordId.
it's always has value
@fzaninotto
Copy link
Member

Your issue says "fix". What exactly are you fixing? Can you provide a repro and detailed steps for the bug?

@alirezaCodeHub
Copy link
Author

Assume that the users resource has three fields username, name, email.

The username field cannot be changed and the email field is unique.

If creating an Edit page with current useUnique() for users resource and try to edit name, validator of email raises error "Must be unique", while the email has not changed.

after debuging useUnique() source code, I found that the useRecordContext() return undefined. in the docs I found another way to get the current page id.

altough this version of useUnique() solve my problem in Edit page, but I think there is a problem in Create page, because Create page hasn't id.

react_admin_bug.mp4

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

Successfully merging this pull request may close these issues.

None yet

2 participants