Skip to content

Commit

Permalink
Fix runtime error after delete cluster task
Browse files Browse the repository at this point in the history
The error happens when user click delete button in confirm delete modal.
The reason is when open the modal it set the callback directly to
`cancelSelection` via `setCancelSelection` but `React.useState` treat
that it must be return a new state value when passing a function to it.
To fix this issue, passing a function that return a callback that want
to set instead.
  • Loading branch information
wingyplus authored and tekton-robot committed May 10, 2021
1 parent 17284d0 commit b132204
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/containers/ClusterTasks/ClusterTasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ function ClusterTasksContainer(props) {
const resourcesById = keyBy(clusterTasks, 'metadata.uid');
setShowDeleteModal(true);
setToBeDeleted(selectedRows.map(({ id }) => resourcesById[id]));
setCancelSelection(handleCancelSelection);
setCancelSelection(() => handleCancelSelection);
}

const batchActionButtons = isReadOnly
Expand Down

0 comments on commit b132204

Please sign in to comment.