mirror of
https://github.com/LHY0125/PathEditor.git
synced 2026-06-29 09:55:56 +08:00
fix: 修复编辑对话框空白及双击编辑无效的问题
- PathEditDialog 添加 useEffect 在打开时同步 initialValue - AppShell 添加 path-dblclick 事件监听,双击路径行打开编辑 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { useState } from 'react';
|
||||
import { useState, useEffect } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
interface PathEditDialogProps {
|
||||
@@ -13,6 +13,13 @@ export function PathEditDialog({ open, title, initialValue, onConfirm, onCancel
|
||||
const { t } = useTranslation();
|
||||
const [value, setValue] = useState(initialValue);
|
||||
|
||||
// 每次打开时同步 initialValue(解决 React 复用实例导致空白的问题)
|
||||
useEffect(() => {
|
||||
if (open) {
|
||||
setValue(initialValue);
|
||||
}
|
||||
}, [open, initialValue]);
|
||||
|
||||
if (!open) return null;
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user