improve: upgrade node to 20, upgrade react-query to v4
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import React, {useState} from "react";
|
||||
import { useSelector, useDispatch } from 'react-redux';
|
||||
import { toggleNodeExpansion } from '../../store/navigationSlice';
|
||||
import { Link } from "react-router-dom";
|
||||
import PermissionGuard from "../PermissionGuard";
|
||||
import "./PathNode.css";
|
||||
@@ -9,10 +11,13 @@ import PathSettingModal from "../Modals/PathSettingModal";
|
||||
|
||||
const PathNode = ({ path, isRoot = false }) => {
|
||||
const [isPathSettingModalOpen, setIsPathSettingModalOpen] = useState(false);
|
||||
const [isExpanded, setIsExpanded] = useState(isRoot);
|
||||
const [isEditing, setIsEditing] = useState(false);
|
||||
const [newName, setNewName] = useState(path.name || "");
|
||||
|
||||
const expandedNodes = useSelector(state => state.navigation.expandedNodes);
|
||||
const dispatch = useDispatch();
|
||||
const isExpanded = isRoot || expandedNodes[path.id];
|
||||
|
||||
const deletePath = useDeletePath();
|
||||
const updatePath = useUpdatePath();
|
||||
|
||||
@@ -23,11 +28,13 @@ const PathNode = ({ path, isRoot = false }) => {
|
||||
|
||||
|
||||
const expand = () => {
|
||||
if(!isExpanded)
|
||||
setIsExpanded(true);
|
||||
if (!isExpanded) {
|
||||
dispatch(toggleNodeExpansion(path.id));
|
||||
}
|
||||
};
|
||||
|
||||
const toggleExpand = () => {
|
||||
setIsExpanded(!isExpanded);
|
||||
dispatch(toggleNodeExpansion(path.id));
|
||||
};
|
||||
|
||||
const handleSave = () => {
|
||||
|
||||
Reference in New Issue
Block a user