-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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: onSelectionChange type incorrect #2567
Conversation
🦋 Changeset detectedLatest commit: af5788d The changes in this PR will be included in the next version bump. This PR includes changesets to release 27 packages
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 |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@winchesHe is attempting to deploy a commit to the NextUI Inc Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughThe updates aim to enhance selection management in dropdowns, selects, and menus by transitioning to Changes
Assessment against linked issues
Recent Review DetailsConfiguration used: .coderabbit.yaml Files selected for processing (6)
Additional comments not posted (9)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Review Status
Actionable comments generated: 0
Configuration used: .coderabbit.yaml
Files selected for processing (5)
- apps/docs/content/docs/components/dropdown.mdx (2 hunks)
- apps/docs/content/docs/components/select.mdx (2 hunks)
- packages/components/menu/src/use-menu.ts (2 hunks)
- packages/components/select/src/use-select.ts (2 hunks)
- packages/core/system-rsc/src/types.ts (2 hunks)
Additional comments: 11
packages/core/system-rsc/src/types.ts (2)
- 5-5: The import statement for
Selection
from@react-types/shared
is correctly added.- 85-88: Extending the
Selection
type withanchorKey
andcurrentKey
properties is a good enhancement for representing selection states more accurately.packages/components/menu/src/use-menu.ts (2)
- 84-87: Adding the
onSelectionChange
handler to theProps
interface with theSelection
type as its parameter is a good enhancement for handling selection changes.- 92-92: Correctly omitting the
onSelectionChange
property fromAriaMenuProps<T>
in theUseMenuProps
type aligns with the PR objectives for handling selection changes more effectively.packages/components/select/src/use-select.ts (3)
- 4-9: The import statement correctly imports
Selection
among other types from@nextui-org/system
, which is necessary for the changes made in this file.- 128-131: Adding the
onSelectionChange
handler to theProps
interface with theSelection
type as its parameter is a good enhancement for handling selection changes in the select component.- 134-138: Correctly modifying the
UseSelectProps
type to excludeonSelectionChange
fromMultiSelectProps
aligns with the PR objectives for handling selection changes more effectively in the select component.apps/docs/content/docs/components/select.mdx (2)
- 341-343: The type definitions for
selectedKeys
,disabledKeys
, anddefaultSelectedKeys
have been updated to useIterable<React.Key>
instead ofReact.Key[]
. This change aligns with the PR objectives to improve type safety and flexibility in handling selections. Ensure that all related components and functions that interact with these properties are updated accordingly to handle theIterable
type.- 382-382: The
onSelectionChange
event handler's type signature has been updated to expect a more detailed parameter type, includinganchorKey
andcurrentKey
. This enhancement is crucial for providing a more accurate representation of selection states and aligns with the PR objectives. Ensure that the implementation of this handler across the library correctly handles the new type structure.apps/docs/content/docs/components/dropdown.mdx (2)
- 311-313: The type definitions for
selectedKeys
,disabledKeys
, anddefaultSelectedKeys
have been updated to useIterable<React.Key>
instead ofReact.Key[]
. This change enhances flexibility in handling selections by allowing any iterable object, not just arrays, to represent selected or disabled keys. This is a positive change that aligns with the PR objectives to improve type safety and flexibility.- 332-332: The
onSelectionChange
handler's type signature has been updated to expect a more specific type, includinganchorKey
andcurrentKey
properties. This change is in line with the PR objectives to correct and enhance type definitions, providing a more detailed and functional representation of selection states. It's a significant improvement for developers managing selections with greater precision.
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.
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.
Error: @nextui-org/react:build: src/index.ts(28,1): error TS2308: Module "@nextui-org/system" has already exported a member named 'Selection'. Consider explicitly re-exporting to resolve the ambiguity.
cfc90a3
to
af5788d
Compare
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.
Actionable comments posted: 1
Actionable comments outside the diff hunks (1)
apps/docs/content/docs/components/dropdown.mdx (1)
Line range hint
5-5
: Ensure the sentence starts with an uppercase letter for consistency.- Displays a list of actions or options that a user can choose. + Displays a list of actions or options that a user can choose.
Closes #2512
📝 Description
Selection
type add addtional key like as shown in the picture below⛳️ Current behavior (updates)
🚀 New behavior
💣 Is this a breaking change (Yes/No):
📝 Additional Information
Summary by CodeRabbit
dropdown
andselect
components to reflect new type usage for keys and updatedonSelectionChange
handler specifications.Selection
type to includeanchorKey
andcurrentKey
.