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

feat(core): add selectedOptionsOrder in useSelect #6071

Merged
merged 7 commits into from
Jul 1, 2024
Merged

feat(core): add selectedOptionsOrder in useSelect #6071

merged 7 commits into from
Jul 1, 2024

Conversation

Dominic-Preap
Copy link
Contributor

@Dominic-Preap Dominic-Preap commented Jun 22, 2024

PR Checklist

Please check if your PR fulfills the following requirements:

Bugs / Features

What is the current behavior?

Cannot sort selectedOptions at the top of list when use useSelect with defaultValue.

What is the new behavior?

feat: add selectedOptionsOrder in useSelect

Fixes #6061

@Dominic-Preap Dominic-Preap requested a review from a team as a code owner June 22, 2024 08:32
Copy link

changeset-bot bot commented Jun 22, 2024

🦋 Changeset detected

Latest commit: 49c26e3

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

@Dominic-Preap Dominic-Preap changed the title feat: add selectedOptionsOrder in useSelect feat(core): add selectedOptionsOrder in useSelect Jun 22, 2024
@BatuhanW BatuhanW added this to the July Release milestone Jun 25, 2024
@BatuhanW BatuhanW linked an issue Jun 25, 2024 that may be closed by this pull request
@aliemir aliemir requested a review from alicanerdurmaz June 27, 2024 08:12
@@ -149,6 +149,20 @@ useSelect({

> For more information, refer to the [`useMany` documentation &#8594](/docs/data/hooks/use-many)

### selectedOptionsOrder
Copy link
Member

@aliemir aliemir Jun 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documentation of other useSelect hooks and extensions should also include this prop:

Hook File
@refinedev/core#useSelect documentation/docs/data/hooks/use-select/index.md
@refinedev/antd#useSelect documentation/docs/ui-integrations/ant-design/hooks/use-select/index.md
@refinedev/antd#useRadioGroup documentation/docs/ui-integrations/ant-design/hooks/use-radio-group/index.md
@refinedev/antd#useCheckboxGroup documentation/docs/ui-integrations/ant-design/hooks/use-checkbox-group/index.md
@refinedev/mui#useAutocomplete documentation/docs/ui-integrations/material-ui/hooks/use-auto-complete/index.md

Additionally, some of them might require small adjustments to make it work:

  • useRadioGroup and useCheckboxGroup should pass the prop to the useSelect hook.
  • useAutocomplete is going to require an additional logic to make the prop work since it uses data directly rather than options from useSelect.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated the related components & the docs. Let me know if I'm missing something.

Copy link
Member

@aliemir aliemir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Dominic-Preap, thank you for the contribution! 🚀 There was a small issue in the test case, I pushed a fix for it! Other than that, I left a comment about the documentation and some adjustments that might be needed for the extensions of the useSelect hook.

Let us know if you can work on these as well 🙏

@Dominic-Preap
Copy link
Contributor Author

Okay I'll update it tonight.

Copy link
Member

@aliemir aliemir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the update @Dominic-Preap! I've sent a small update and added @refinedev/antd and @refinedev/mui to the changeset 🚀

@BatuhanW BatuhanW merged commit 853bef9 into refinedev:releases/july Jul 1, 2024
14 checks passed
@BatuhanW BatuhanW mentioned this pull request Jul 1, 2024
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.

[FEAT]: Have ability to sort selectedOptions first in useSelect
4 participants