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

fix: Modal is blinking when opening #16035

Merged
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion superset-frontend/src/common/components/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ export {
Dropdown,
Form,
Empty,
Modal,
Typography,
Tree,
Popover,
Expand All @@ -58,6 +57,7 @@ export {
Input as AntdInput,
} from 'antd';
export { Card as AntdCard } from 'antd';
export { default as Modal, ModalProps } from 'antd/lib/modal';
export { FormInstance } from 'antd/lib/form';
export { RadioChangeEvent } from 'antd/lib/radio';
export { TreeProps } from 'antd/lib/tree';
Expand Down
19 changes: 14 additions & 5 deletions superset-frontend/src/components/Modal/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ import React from 'react';
import { isNil } from 'lodash';
import { styled, t } from '@superset-ui/core';
import { css } from '@emotion/react';
import { Modal as BaseModal } from 'src/common/components';
import {
Modal as AntdModal,
ModalProps as AntdModalProps,
} from 'src/common/components';
import Button from 'src/components/Button';

export interface ModalProps {
Expand Down Expand Up @@ -52,6 +55,12 @@ interface StyledModalProps {
hideFooter?: boolean;
}

const BaseModal = (props: AntdModalProps) => (
// Removes mask animation. Fixed in 4.6.0.
// https://github.com/ant-design/ant-design/issues/27192
<AntdModal {...props} maskTransitionName="" />
);

export const StyledModal = styled(BaseModal)<StyledModalProps>`
${({ theme, responsive, maxWidth }) =>
responsive &&
Expand Down Expand Up @@ -188,10 +197,10 @@ CustomModal.displayName = 'Modal';
// and demote it as the default export.
// We should start using AntD component interfaces going forward.
const Modal = Object.assign(CustomModal, {
error: BaseModal.error,
warning: BaseModal.warning,
confirm: BaseModal.confirm,
useModal: BaseModal.useModal,
error: AntdModal.error,
warning: AntdModal.warning,
confirm: AntdModal.confirm,
useModal: AntdModal.useModal,
});

export default Modal;