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

docs(components): accordion controlled example shows errors #2339

Merged
merged 4 commits into from
Mar 3, 2024
Merged

docs(components): accordion controlled example shows errors #2339

merged 4 commits into from
Mar 3, 2024

Conversation

kuri-sun
Copy link
Contributor

Closes #2337

📝 Description

After you copy and paste the code from controlled accordion example, you will an error on the onSelectionChange function.
old
Because we are missing the type for the useState.

⛳️ Current behavior (updates)

Throwing the following error

Type 'Dispatch<SetStateAction<Set<string>>>' is not assignable to type '(keys: Selection) => any'.
  Types of parameters 'value' and 'keys' are incompatible.
    Type 'Selection' is not assignable to type 'SetStateAction<Set<string>>'.
      Type 'string' is not assignable to type 'SetStateAction<Set<string>>'.ts(2322)

🚀 New behavior

No error.
new

💣 Is this a breaking change (Yes/No):

No.

📝 Additional Information

Copy link

changeset-bot bot commented Feb 11, 2024

⚠️ No Changeset found

Latest commit: 41fe028

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Feb 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nextui-storybook-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 3, 2024 9:30pm

Copy link

vercel bot commented Feb 11, 2024

@kuri-sun is attempting to deploy a commit to the NextUI Team on Vercel.

A member of the Team first needs to authorize it.

@kuri-sun
Copy link
Contributor Author

@jrgarciadev Thanks for the review! The change is applied! 👍

@@ -1,7 +1,7 @@
const App = `import {Accordion, AccordionItem} from "@nextui-org/react";

export default function App() {
const [selectedKeys, setSelectedKeys] = React.useState(new Set(["1"]));
const [selectedKeys, setSelectedKeys] = React.useState<Selection>(new Set(["1"]));
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const [selectedKeys, setSelectedKeys] = React.useState<Selection>(new Set(["1"]));
const [selectedKeys, setSelectedKeys] = React.useState(new Set(["1"]));

As this file is meant to be used as plain "Javascript" file we cannot add typescript code

@jrgarciadev jrgarciadev merged commit 2dc5adb into heroui-inc:main Mar 3, 2024
7 of 8 checks passed
@kuri-sun kuri-sun deleted the docs/components/accordion-controlled-example-shows-errors branch March 4, 2024 04:50
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.

[BUG] - Accordion Controlled Example shows errors
2 participants