fix: update file handling and improve query logging

- Added mes-architecture-guide.md to .gitignore to prevent unnecessary tracking.
- Enhanced NodeFlowExecutionService to merge context data for WHERE clause, improving query accuracy.
- Updated logging to include values in SQL query logs for better debugging.
- Removed redundant event dispatches in V2Repeater to streamline save operations.
- Adjusted DynamicComponentRenderer to conditionally refresh keys based on component type.
- Improved FileUploadComponent to clear localStorage only for modal components, preventing unintended resets in non-modal contexts.

These changes aim to enhance the overall functionality and maintainability of the application, ensuring better data handling and user experience.
This commit is contained in:
kjs
2026-03-18 17:43:03 +09:00
parent 359bf0e614
commit c634e1e054
8 changed files with 95 additions and 87 deletions

View File

@@ -106,6 +106,7 @@ const FileUploadComponent: React.FC<FileUploadComponentProps> = ({
const [forceUpdate, setForceUpdate] = useState(0);
const [representativeImageUrl, setRepresentativeImageUrl] = useState<string | null>(null);
const fileInputRef = useRef<HTMLInputElement>(null);
const containerRef = useRef<HTMLDivElement>(null);
// 🔑 레코드 모드 판단: formData에 id가 있으면 특정 행에 연결된 파일 관리
const isRecordMode = !!(formData?.id && !String(formData.id).startsWith('temp_'));
@@ -217,18 +218,17 @@ const FileUploadComponent: React.FC<FileUploadComponentProps> = ({
}
}, [component.id, getUniqueKey, recordId, isRecordMode]);
// 🆕 모달 닫힘/저장 성공 시 localStorage 파일 캐시 정리 (등록 후 재등록 시 이전 파일 잔존 방지)
// 모달 닫힘/저장 성공 시 localStorage 파일 캐시 정리 (등록 후 재등록 시 이전 파일 잔존 방지)
// 모달(Dialog) 내부의 컴포넌트만 초기화 대상 - 일반 화면의 파일 업로드는 초기화하지 않음
useEffect(() => {
const handleClearFileCache = (event: Event) => {
// 모달 내부 컴포넌트만 초기화 (일반 화면에서는 스킵)
const isInModal = containerRef.current ? !!containerRef.current.closest('[role="dialog"]') : false;
if (!isInModal) {
return;
}
const backupKey = getUniqueKey();
const eventType = event.type;
console.log("🧹 [DEBUG-CLEAR] 파일 캐시 정리 이벤트 수신:", {
eventType,
backupKey,
componentId: component.id,
currentFiles: uploadedFiles.length,
hasLocalStorage: !!localStorage.getItem(backupKey),
});
try {
localStorage.removeItem(backupKey);
setUploadedFiles([]);
@@ -238,22 +238,15 @@ const FileUploadComponent: React.FC<FileUploadComponentProps> = ({
delete globalFileState[backupKey];
(window as any).globalFileState = globalFileState;
}
console.log("🧹 [DEBUG-CLEAR] 정리 완료:", backupKey);
} catch (e) {
console.warn("파일 캐시 정리 실패:", e);
}
};
// EditModal 닫힘, ScreenModal 연속 등록 저장 성공, 일반 저장 성공 모두 처리
window.addEventListener("closeEditModal", handleClearFileCache);
window.addEventListener("saveSuccess", handleClearFileCache);
window.addEventListener("saveSuccessInModal", handleClearFileCache);
console.log("🔎 [DEBUG-CLEAR] 이벤트 리스너 등록 완료:", {
componentId: component.id,
backupKey: getUniqueKey(),
});
return () => {
window.removeEventListener("closeEditModal", handleClearFileCache);
window.removeEventListener("saveSuccess", handleClearFileCache);
@@ -1190,10 +1183,11 @@ const FileUploadComponent: React.FC<FileUploadComponentProps> = ({
return (
<div
ref={containerRef}
style={{
...componentStyle,
width: "100%", // 🆕 부모 컨테이너 너비에 맞춤
height: "100%", // 🆕 부모 컨테이너 높이에 맞춤
width: "100%",
height: "100%",
border: "none !important",
boxShadow: "none !important",
outline: "none !important",