nytai commented on a change in pull request #8979: [dashboard] new, bulk
actions for delete & export
URL:
https://github.com/apache/incubator-superset/pull/8979#discussion_r370281839
##########
File path: superset/assets/src/components/ConfirmStatusChange.tsx
##########
@@ -21,54 +21,43 @@ import * as React from 'react';
// @ts-ignore
import { Button, Modal } from 'react-bootstrap';
-type ShowCallback = (callback: (e: any) => any) => (event: any) => any;
-
+type Callback = (...args: any[]) => void;
interface Props {
title: string | React.ReactNode;
description: string | React.ReactNode;
- children: (confirm: ShowCallback) => React.ReactNode;
+ onConfirm: Callback;
+ children: (showConfirm: Callback) => React.ReactNode;
}
interface State {
+ callbackArgs: any[];
open: boolean;
- callback: (e: React.MouseEvent) => void;
}
-const defaultCallback = () => { console.error('ConfirmStatusChange invoked
with the default callback, please provide a function to be called on confirm');
};
export default class ConfirmStatusChange extends React.Component<Props, State>
{
public state = {
- callback: defaultCallback,
+ callbackArgs: [],
open: false,
};
- public show: ShowCallback = (callback) => (event) => {
- if (typeof event.preventDefault === 'function') {
- event.preventDefault();
-
- event = {
- ...event,
- currentTarget: { ...event.currentTarget },
- };
- }
-
+ public showConfirm = (...callbackArgs: any[]) => {
this.setState({
- callback: () => callback(event),
+ callbackArgs,
Review comment:
Good catch, I was cloning it before. None of my current use cases rely on
the dom event, but probably best to handle that to avoid future weirdness.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]