fix: 화면 복귀 시 카테고리 매핑 갱신 보장
- loading 상태를 의존성으로 변경 - 데이터 로드 완료 시점(loading: false)에 매핑 갱신 - 화면 전환 후 복귀 시에도 최신 카테고리 데이터 반영 - 로딩 중에는 매핑 로드하지 않도록 가드 추가
This commit is contained in:
parent
95b341df79
commit
cd961a2162
|
|
@ -430,6 +430,9 @@ export const TableListComponent: React.FC<TableListComponentProps> = ({
|
|||
const loadCategoryMappings = async () => {
|
||||
if (!tableConfig.selectedTable || !columnMeta) return;
|
||||
|
||||
// 로딩 중에는 매핑 로드하지 않음 (데이터 로드 완료 후에만 실행)
|
||||
if (loading) return;
|
||||
|
||||
try {
|
||||
const categoryColumns = Object.entries(columnMeta)
|
||||
.filter(([_, meta]) => meta.inputType === "category")
|
||||
|
|
@ -443,7 +446,8 @@ export const TableListComponent: React.FC<TableListComponentProps> = ({
|
|||
console.log("🔄 [TableList] 카테고리 매핑 로드 시작:", {
|
||||
table: tableConfig.selectedTable,
|
||||
categoryColumns,
|
||||
refreshTrigger,
|
||||
dataLength: data.length,
|
||||
loading,
|
||||
});
|
||||
|
||||
const mappings: Record<string, Record<string, { label: string; color?: string }>> = {};
|
||||
|
|
@ -479,7 +483,7 @@ export const TableListComponent: React.FC<TableListComponentProps> = ({
|
|||
};
|
||||
|
||||
loadCategoryMappings();
|
||||
}, [tableConfig.selectedTable, columnMeta, data.length]); // data.length로 데이터 변경 감지
|
||||
}, [tableConfig.selectedTable, columnMeta, loading]); // loading이 false가 될 때마다 갱신!
|
||||
|
||||
// ========================================
|
||||
// 데이터 가져오기
|
||||
|
|
|
|||
Loading…
Reference in New Issue