Skip to content

Commit

Permalink
refactor: 优化modal框挂载逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
Miracle575 committed Nov 8, 2023
1 parent 8c3cb61 commit 3f62efc
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import { App, Form, Input, Modal } from "antd";
import { dirname, join } from "path";
import { useRef, useState } from "react";
import { useState } from "react";
import { api } from "src/apis";
import { prefix, useI18nTranslateToString } from "src/i18n";

Expand All @@ -37,8 +37,6 @@ export const RenameModal: React.FC<Props> = ({ open, onClose, path, reload, clus
const [form] = Form.useForm<FormProps>();
const [loading, setLoading] = useState(false);

const containerRef = useRef(null);

const t = useI18nTranslateToString();

const onSubmit = async () => {
Expand All @@ -56,7 +54,7 @@ export const RenameModal: React.FC<Props> = ({ open, onClose, path, reload, clus
};

return (
<div ref={containerRef} onDoubleClick={(event) => event.stopPropagation()}>
<div onDoubleClick={(event) => event.stopPropagation()}>
<Modal
open={open}
title={t(p("title"))}
Expand All @@ -66,7 +64,7 @@ export const RenameModal: React.FC<Props> = ({ open, onClose, path, reload, clus
confirmLoading={loading}
destroyOnClose
onOk={form.submit}
getContainer={containerRef.current || false}
getContainer={false}
>
<Form form={form} onFinish={onSubmit}>
<Form.Item label={t(p("renameLabel"))}>
Expand Down

0 comments on commit 3f62efc

Please sign in to comment.