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

Remove data requirement from arc #892

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions packages/visx-shape/src/shapes/Arc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import { arc } from '../util/D3ShapeFactories';
export type ArcProps<Datum> = {
/** className applied to path element. */
className?: string;
/** A Datum for which to generate an arc. */
data?: Datum;
/** Override render function which is passed the configured arc generator as input. */
children?: (args: { path: ArcType<$TSFIXME, Datum> }) => React.ReactNode;
/** React ref to the path element. */
Expand All @@ -17,7 +15,6 @@ export type ArcProps<Datum> = {

export default function Arc<Datum>({
className,
data,
innerRadius,
outerRadius,
cornerRadius,
Expand All @@ -41,13 +38,12 @@ export default function Arc<Datum>({

// eslint-disable-next-line react/jsx-no-useless-fragment
if (children) return <>{children({ path })}</>;
if (!data) return null;
Copy link
Collaborator

Choose a reason for hiding this comment

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

since data is already optional, I think this is probably the only line that needs to be removed since it is valid to call path without arguments.


return (
<path
ref={innerRef}
className={cx('visx-arc', className)}
d={path(data) || ''}
d={path() || ''}
{...restProps}
/>
);
Expand Down