fix: do not cache while watching during manual updates
This commit is contained in:
@@ -81,6 +81,7 @@ const DeleteModal = forwardRef((props, ref) => {
|
||||
const [configuration, setConfiguration] = useState<Configuration>({
|
||||
checked: false
|
||||
});
|
||||
const [delLoading, setDelLoading] = useState(false);
|
||||
const [config, setConfig] = useState<ModalFuncProps & DataOptions>({} as any);
|
||||
|
||||
const show = (data: ModalFuncProps & DataOptions) => {
|
||||
@@ -105,6 +106,7 @@ const DeleteModal = forwardRef((props, ref) => {
|
||||
|
||||
const handleOk = async () => {
|
||||
try {
|
||||
setDelLoading(true);
|
||||
const res = await config.onOk?.();
|
||||
const isArray = Array.isArray(res);
|
||||
if (isArray) {
|
||||
@@ -121,6 +123,7 @@ const DeleteModal = forwardRef((props, ref) => {
|
||||
// Handle error if needed
|
||||
} finally {
|
||||
setVisible(false);
|
||||
setDelLoading(false);
|
||||
restoreScrollHeight();
|
||||
}
|
||||
};
|
||||
@@ -156,7 +159,13 @@ const DeleteModal = forwardRef((props, ref) => {
|
||||
? intl.formatMessage({ id: config.cancelText })
|
||||
: intl.formatMessage({ id: 'common.button.cancel' })}
|
||||
</Button>
|
||||
<Button type="primary" onClick={handleOk} size="middle" danger>
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={handleOk}
|
||||
size="middle"
|
||||
danger
|
||||
loading={delLoading}
|
||||
>
|
||||
{config.okText
|
||||
? intl.formatMessage({ id: config.okText })
|
||||
: intl.formatMessage({ id: 'common.button.delete' })}
|
||||
|
||||
Reference in New Issue
Block a user