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: Pie: support multiple activeIds #2670

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

assaf-aviram
Copy link

No description provided.

Copy link

vercel bot commented Nov 14, 2024

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

Name Status Preview Comments Updated (UTC)
nivo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 14, 2024 8:57pm

@@ -20,6 +20,9 @@ import {
CommonPieProps,
} from './types'

const idIsActive = (id: DatumId, activeId: null | DatumId | DatumId[]) =>
Copy link
Owner

Choose a reason for hiding this comment

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

Rather than supporting a scalar or an array, I think it would be better to rename the property to activeIds and to support arrays exclusively.

It would also be nice to add tests about this new feature and to adjust the documentation.

Copy link
Author

Choose a reason for hiding this comment

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

I wanted to avoid making this a breaking change to anyone using activeId. Do you think it's worth it?

Copy link
Owner

Choose a reason for hiding this comment

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

I understand, but it makes the code and typing more complex, I'd prefer to have something a bit simpler to maintain, also the name of the property is now confusing IMHO.

@@ -282,6 +282,76 @@ export const ControlledActiveId: Story = {
render: () => <ControlledPies />,
}

const ControlledPiesMultipleActiveIds = () => {
const [activeId, setActiveId] = useState<string>(commonProperties.data[1].id)
const [additionalActiveIds, setAdditionalActiveIds] = useState<string>([])
Copy link
Owner

Choose a reason for hiding this comment

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

The type should be string[] I think.

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.

2 participants