refine
                                
                                 refine copied to clipboard
                                
                                    refine copied to clipboard
                            
                            
                            
                        feat(core): added custom optionLabel
PR Checklist
Please check if your PR fulfills the following requirements:
- [x] The commit message follows our guidelines: https://refine.dev/docs/guides-concepts/contributing/#commit-convention
Bugs / Features
- [x] Related issue(s) linked
- [x] Tests for the changes have been added
- [ ] Docs have been added / updated
- [x] Changesets have been added https://refine.dev/docs/guides-concepts/contributing/#creating-a-changeset
What is the current behavior?
What is the new behavior?
fixes #4880
Notes for reviewers
‼️ If provided changes meet the required changes than I should go further with docs. ‼️
🦋 Changeset detected
Latest commit: 13c3e48abdb0013aa9610a659a3a956f94c2d382
The changes in this PR will be included in the next version bump.
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
☁️ Nx Cloud Report
CI is running/has finished running commands for commit 13c3e48abdb0013aa9610a659a3a956f94c2d382. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.
📂 See all runs for this CI Pipeline Execution
✅ Successfully ran 73 targets
- lerna run cypress:run --scope with-remix-material-ui -- --record --key --group with-remix-material-ui
- lerna run cypress:run --scope with-remix-headless -- --record --key --group with-remix-headless
- lerna run cypress:run --scope with-remix-antd -- --record --key --group with-remix-antd
- lerna run cypress:run --scope with-nextjs-next-auth -- --record --key --group with-nextjs-next-auth
- lerna run cypress:run --scope with-nextjs -- --record --key --group with-nextjs
- lerna run cypress:run --scope table-react-table-basic -- --record --key --group table-react-table-basic
- lerna run cypress:run --scope table-react-table-advanced -- --record --key --group table-react-table-advanced
- lerna run cypress:run --scope table-material-ui-use-update-many -- --record --key --group table-material-ui-use-update-many
- lerna run cypress:run --scope table-material-ui-use-delete-many -- --record --key --group table-material-ui-use-delete-many
- lerna run cypress:run --scope table-material-ui-use-data-grid -- --record --key --group table-material-ui-use-data-grid
- lerna run cypress:run --scope table-material-ui-table-filter -- --record --key --group table-material-ui-table-filter
- lerna run cypress:run --scope table-material-ui-data-grid-pro -- --record --key --group table-material-ui-data-grid-pro
- lerna run cypress:run --scope table-material-ui-cursor-pagination -- --record --key --group table-material-ui-cursor-pagination
- lerna run cypress:run --scope table-material-ui-advanced -- --record --key --group table-material-ui-advanced
- lerna run cypress:run --scope table-mantine-basic -- --record --key --group table-mantine-basic
- lerna run cypress:run --scope table-mantine-advanced -- --record --key --group table-mantine-advanced
- lerna run cypress:run --scope form-material-ui-mutation-mode -- --record --key --group form-material-ui-mutation-mode
- lerna run cypress:run --scope table-handson -- --record --key --group table-handson
- lerna run cypress:run --scope table-chakra-ui-basic -- --record --key --group table-chakra-ui-basic
- lerna run cypress:run --scope form-mantine-use-steps-form -- --record --key --group form-mantine-use-steps-form
- lerna run cypress:run --scope table-chakra-ui-advanced -- --record --key --group table-chakra-ui-advanced
- lerna run cypress:run --scope table-antd-use-update-many -- --record --key --group table-antd-use-update-many
- lerna run cypress:run --scope form-mantine-use-modal-form -- --record --key --group form-mantine-use-modal-form
- lerna run cypress:run --scope table-antd-use-table -- --record --key --group table-antd-use-table
- lerna run cypress:run --scope table-antd-use-editable-table -- --record --key --group table-antd-use-editable-table
- lerna run cypress:run --scope table-antd-use-delete-many -- --record --key --group table-antd-use-delete-many
- lerna run cypress:run --scope table-antd-table-filter -- --record --key --group table-antd-table-filter
- lerna run cypress:run --scope auth-keycloak -- --record --key --group auth-keycloak
- lerna run cypress:run --scope table-antd-advanced -- --record --key --group table-antd-advanced
- lerna run cypress:run --scope form-mantine-use-form -- --record --key --group form-mantine-use-form
- lerna run cypress:run --scope auth-headless -- --record --key --group auth-headless
- lerna run cypress:run --scope server-side-form-validation-material-ui -- --record --key --group server-side-form-validation-material-ui
- lerna run cypress:run --scope auth-google-login -- --record --key --group auth-google-login
- lerna run cypress:run --scope server-side-form-validation-mantine -- --record --key --group server-side-form-validation-mantine
- lerna run cypress:run --scope form-antd-use-form -- --record --key --group form-antd-use-form
- lerna run cypress:run --scope auth-chakra-ui -- --record --key --group auth-chakra-ui
- lerna run cypress:run --scope server-side-form-validation-chakra-ui -- --record --key --group server-side-form-validation-chakra-ui
- lerna run cypress:run --scope form-mantine-use-drawer-form -- --record --key --group form-mantine-use-drawer-form
- lerna run cypress:run --scope form-antd-use-drawer-form -- --record --key --group form-antd-use-drawer-form
- lerna run cypress:run --scope auth-auth0 -- --record --key --group auth-auth0
- lerna run cypress:run --scope server-side-form-validation-antd -- --record --key --group server-side-form-validation-antd
- lerna run cypress:run --scope inferencer-material-ui -- --record --key --group inferencer-material-ui
- lerna run cypress:run --scope form-antd-mutation-mode -- --record --key --group form-antd-mutation-mode
- lerna run cypress:run --scope auth-antd -- --record --key --group auth-antd
- lerna run cypress:run --scope form-chakra-use-modal-form -- --record --key --group form-chakra-use-modal-form
- lerna run cypress:run --scope form-antd-custom-validation -- --record --key --group form-antd-custom-validation
- lerna run cypress:run --scope inferencer-mantine -- --record --key --group inferencer-mantine
- lerna run cypress:run --scope form-chakra-ui-use-form -- --record --key --group form-chakra-ui-use-form
- lerna run cypress:run --scope data-provider-supabase -- --record --key --group data-provider-supabase
- lerna run cypress:run --scope base-material-ui -- --record --key --group base-material-ui
- lerna run cypress:run --scope form-mantine-mutation-mode -- --record --key --group form-mantine-mutation-mode
- lerna run cypress:run --scope form-chakra-ui-use-drawer-form -- --record --key --group form-chakra-ui-use-drawer-form
- lerna run cypress:run --scope base-mantine -- --record --key --group base-mantine
- lerna run cypress:run --scope inferencer-headless -- --record --key --group inferencer-headless
- lerna run cypress:run --scope data-provider-strapi-v4 -- --record --key --group data-provider-strapi-v4
- lerna run cypress:run --scope form-chakra-ui-mutation-mode -- --record --key --group form-chakra-ui-mutation-mode
- lerna run cypress:run --scope inferencer-graphql-hasura -- --record --key --group inferencer-graphql-hasura
- lerna run cypress:run --scope form-react-hook-form-use-modal-form -- --record --key --group form-react-hook-form-use-modal-form
- lerna run cypress:run --scope base-chakra-ui -- --record --key --group base-chakra-ui
- lerna run cypress:run --scope form-antd-use-steps-form -- --record --key --group form-antd-use-steps-form
- lerna run cypress:run --scope base-antd -- --record --key --group base-antd
- lerna run cypress:run --scope inferencer-chakra-ui -- --record --key --group inferencer-chakra-ui
- lerna run cypress:run --scope form-react-hook-form-use-form -- --record --key --group form-react-hook-form-use-form
- lerna run cypress:run --scope form-antd-use-modal-form -- --record --key --group form-antd-use-modal-form
- lerna run cypress:run --scope form-material-ui-use-steps-form -- --record --key --group form-material-ui-use-steps-form
- lerna run cypress:run --scope auth-material-ui -- --record --key --group auth-material-ui
- lerna run cypress:run --scope form-material-ui-use-modal-form -- --record --key --group form-material-ui-use-modal-form
- lerna run cypress:run --scope inferencer-antd -- --record --key --group inferencer-antd
- lerna run cypress:run --scope auth-mantine -- --record --key --group auth-mantine
- lerna run cypress:run --scope form-material-ui-use-form -- --record --key --group form-material-ui-use-form
- lerna run cypress:run --scope form-save-and-continue -- --record --key --group form-save-and-continue
- lerna run cypress:run --scope form-material-ui-use-drawer-form -- --record --key --group form-material-ui-use-drawer-form
- lerna run cypress:run --scope form-react-hook-form-use-steps-form -- --record --key --group form-react-hook-form-use-steps-form
Sent with 💌 from NxCloud.
Hey @Conqxeror thanks for the PR with great description as always!
Let's do the implementation according to the comment here: https://github.com/refinedev/refine/issues/4880#issuecomment-1742600902
optionValue and optionLabel params are currently string only, let's make each of them a union of string or function. And invoke the given function with item as in your implementation.
It would be amazing to implement similar changes for similar hooks other than @refinedev/core's useSelect.
@refinedev/antd has following hooks which can be refactored in a similar way:
- useSelect
- useRadioGroup
- useCheckboxGroup
Hey @Conqxeror thanks for the PR with great description as always!
Let's do the implementation according to the comment here: #4880 (comment)
optionValueandoptionLabelparams are currently string only, let's make each of them a union of string or function. And invoke the given function withitemas in your implementation.It would be amazing to implement similar changes for similar hooks other than
@refinedev/core'suseSelect.
@refinedev/antdhas following hooks which can be refactored in a similar way:
- useSelect
- useRadioGroup
- useCheckboxGroup
Thanks, @BatuhanW ! Your feedback is always appreciated. I always find your reviews great! I'll update optionValue and optionLabel as per the comment in #4880 (comment). Also, extending these changes to @refinedev/antd's useSelect, useRadioGroup, and useCheckboxGroup sounds great.
Hello @BatuhanW I wanted to know if all the required changes are satisfied or not. If so then I can go further with the docs.
Review it whenever you are free, its okay if you take time.