mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
made node editor use SWR
This commit is contained in:
parent
2eb10c4da7
commit
64cc47a116
5 changed files with 45 additions and 45 deletions
|
@ -1,4 +1,4 @@
|
|||
import React, { createElement, FC, useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import React, { createElement, FC, useCallback, useMemo, useState } from 'react';
|
||||
import { IDialogProps } from '~/redux/modal/constants';
|
||||
import styles from './styles.module.scss';
|
||||
import { NODE_EDITORS } from '~/redux/node/constants';
|
||||
|
@ -25,7 +25,7 @@ const EditorDialog: FC<Props> = ({ node, onRequestClose }) => {
|
|||
|
||||
const uploader = useFileUploader(UPLOAD_SUBJECTS.EDITOR, UPLOAD_TARGETS.NODES, node.files);
|
||||
const formik = useNodeFormFormik(node, uploader, onRequestClose);
|
||||
const { values, handleSubmit, dirty, status, setStatus } = formik;
|
||||
const { values, handleSubmit, dirty, status } = formik;
|
||||
|
||||
const component = useMemo(() => node.type && prop(node.type, NODE_EDITORS), [node.type]);
|
||||
|
||||
|
@ -49,14 +49,6 @@ const EditorDialog: FC<Props> = ({ node, onRequestClose }) => {
|
|||
|
||||
const error = useTranslatedError(status);
|
||||
|
||||
useEffect(() => {
|
||||
if (!status) {
|
||||
return;
|
||||
}
|
||||
|
||||
setStatus('');
|
||||
}, [setStatus, status, values]);
|
||||
|
||||
useCloseOnEscape(onClose);
|
||||
|
||||
if (!component) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue