Skip to content

Commit

Permalink
chore: refactor ChartHolder to typescript + tests (#20910)
Browse files Browse the repository at this point in the history
  • Loading branch information
diegomedina248 authored Sep 5, 2022
1 parent d994bab commit b71182f
Show file tree
Hide file tree
Showing 9 changed files with 1,005 additions and 574 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ import getLocationHash from 'src/dashboard/util/getLocationHash';

export type AnchorLinkProps = {
id: string;
dashboardId?: number;
scrollIntoView?: boolean;
showShortLinkButton?: boolean;
} & Pick<URLShortLinkButtonProps, 'dashboardId' | 'placement'>;
} & Pick<URLShortLinkButtonProps, 'placement'>;

export default function AnchorLink({
id,
Expand Down
20 changes: 13 additions & 7 deletions superset-frontend/src/dashboard/components/dnd/DragDroppable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ const propTypes = {
useEmptyDragPreview: PropTypes.bool,

// from react-dnd
isDragging: PropTypes.bool.isRequired,
isDraggingOver: PropTypes.bool.isRequired,
isDraggingOverShallow: PropTypes.bool.isRequired,
droppableRef: PropTypes.func.isRequired,
dragSourceRef: PropTypes.func.isRequired,
dragPreviewRef: PropTypes.func.isRequired,
isDragging: PropTypes.bool,
isDraggingOver: PropTypes.bool,
isDraggingOverShallow: PropTypes.bool,
droppableRef: PropTypes.func,
dragSourceRef: PropTypes.func,
dragPreviewRef: PropTypes.func,
};

const defaultProps = {
Expand All @@ -63,6 +63,12 @@ const defaultProps = {
onDrop() {},
orientation: 'row',
useEmptyDragPreview: false,
isDragging: false,
isDraggingOver: false,
isDraggingOverShallow: false,
droppableRef() {},
dragSourceRef() {},
dragPreviewRef() {},
};

// export unwrapped component for testing
Expand Down Expand Up @@ -95,7 +101,7 @@ export class UnwrappedDragDroppable extends React.PureComponent {
} else {
this.props.dragPreviewRef(ref);
}
this.props.droppableRef(ref);
this.props.droppableRef?.(ref);
}

render() {
Expand Down
Loading

0 comments on commit b71182f

Please sign in to comment.