1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-24 12:58:34 +00:00

fix(wiki title): resolve name change (#7863)

This commit is contained in:
Guodong SU
2025-05-30 15:32:04 +08:00
committed by GitHub
parent 99af77c8eb
commit 92b80c84c5

View File

@@ -48,6 +48,7 @@ const PageItem = ({
const [isMouseEntered, setIsMouseEntered] = useState(false); const [isMouseEntered, setIsMouseEntered] = useState(false);
const ref = useRef(null); const ref = useRef(null);
const toggleTriggeredRef = useRef(false);
const [, drag] = useDrag(() => ({ const [, drag] = useDrag(() => ({
type: 'wiki-page', type: 'wiki-page',
@@ -140,6 +141,7 @@ const PageItem = ({
e.stopPropagation(); e.stopPropagation();
} }
setIsShowNameEditor(!isShowNameEditor); setIsShowNameEditor(!isShowNameEditor);
toggleTriggeredRef.current = true;
}, [isShowNameEditor]); }, [isShowNameEditor]);
const changeItemFreeze = (isFreeze) => { const changeItemFreeze = (isFreeze) => {
@@ -197,8 +199,9 @@ const PageItem = ({
}, [updateSelected]); }, [updateSelected]);
useEffect(() => { useEffect(() => {
if (!isShowNameEditor) { if (!isShowNameEditor && toggleTriggeredRef.current) {
savePageProperties(); savePageProperties();
toggleTriggeredRef.current = false;
} }
}, [isShowNameEditor, savePageProperties]); }, [isShowNameEditor, savePageProperties]);