-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Feat: Fix radiobuttongroup inse referenceInput #8214
Conversation
@@ -125,7 +125,10 @@ export const useReferenceInputController = <RecordType extends RaRecord = any>( | |||
finalData = possibleValuesData; | |||
finalTotal = total; | |||
} else { | |||
finalData = [referenceRecord, ...possibleValuesData]; | |||
finalData = [...possibleValuesData]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the only solution I have found for now.
During a short time, referenceRecord becomes the selected value in the radio group.
So we have a finalData with a duplicate.
I will add it in two steps with a check to avoid the rendering jump
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest you use a JavaScript Set instead
https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Global_Objects/Set
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had tried this technique, but it creates a "flick" when rendering the component.
flickrendering.mp4
@@ -125,7 +125,10 @@ export const useReferenceInputController = <RecordType extends RaRecord = any>( | |||
finalData = possibleValuesData; | |||
finalTotal = total; | |||
} else { | |||
finalData = [referenceRecord, ...possibleValuesData]; | |||
finalData = [...possibleValuesData]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest you use a JavaScript Set instead
https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Global_Objects/Set
Superseded by #8229 |
radiobutton.mp4