make cellId optional

This commit is contained in:
sunilyadav840
2021-05-21 14:31:45 +05:30
parent 1e0a0b73e0
commit 1e32838f60
2 changed files with 3 additions and 3 deletions
@@ -54,11 +54,11 @@ export const SET_HOVERED_CELL = "SET_HOVERED_CELL";
export interface SetHoveredCellAction { export interface SetHoveredCellAction {
type: "SET_HOVERED_CELL"; type: "SET_HOVERED_CELL";
payload: { payload: {
cellId: CellId; cellId?: CellId;
}; };
} }
export const setHoveredCell = (payload: { cellId: CellId }): SetHoveredCellAction => { export const setHoveredCell = (payload: { cellId?: CellId }): SetHoveredCellAction => {
return { return {
type: SET_HOVERED_CELL, type: SET_HOVERED_CELL,
payload, payload,
@@ -30,7 +30,7 @@ class HoverableCell extends React.Component<ComponentProps & DispatchProps> {
const mapDispatchToProps = (dispatch: Dispatch, { id }: { id: string }): DispatchProps => ({ const mapDispatchToProps = (dispatch: Dispatch, { id }: { id: string }): DispatchProps => ({
hover: () => dispatch(actions.setHoveredCell({ cellId: id })), hover: () => dispatch(actions.setHoveredCell({ cellId: id })),
unHover: () => dispatch(actions.setHoveredCell({ cellId: "" })), unHover: () => dispatch(actions.setHoveredCell({ cellId: undefined })),
}); });
export default connect(undefined, mapDispatchToProps)(HoverableCell); export default connect(undefined, mapDispatchToProps)(HoverableCell);