diff --git a/src/pages/CorpImport/ColumnMapper.js b/src/pages/CorpImport/ColumnMapper.js index 29f430d4..de84ee03 100644 --- a/src/pages/CorpImport/ColumnMapper.js +++ b/src/pages/CorpImport/ColumnMapper.js @@ -82,7 +82,7 @@ function Columns({ blob, index, fieldOptions, columnTypes, onSetColumnType }) { const blobId = blob.get("id"); const values = blob.get("values"); const column = index ? "sentence" : "base sentence"; - const columnIdStr = `${index}:${column}`; + const columnIdStr = `${index}:sentence`; const value = values.get(columnIdStr); return ( diff --git a/src/pages/CorpImport/Linker.js b/src/pages/CorpImport/Linker.js index a29220cd..f3dc8e06 100644 --- a/src/pages/CorpImport/Linker.js +++ b/src/pages/CorpImport/Linker.js @@ -11,13 +11,21 @@ function valueColor(value) { return "yellow"; } -function Columns({ blob, index, onUpdateColumn, onToggleColumn, onDelete }) { +function Columns({ blob, index, total, onUpdateColumn, onToggleColumn, onDelete }) { const getTranslation = useContext(TranslationContext); const value = index ? "secondary" : "base"; const column = index ? "sentence" : "base sentence"; - const idStr = `${index}:${column}`; + const idStr = `${index}:sentence`; - useEffect(() => { onUpdateColumn(idStr, value, null); }, [idStr]); + /* Clean other values and set a fresh one. + /* In the interface after a blob removing another blobs change their index numbers, + /* but they still store old values with old index numbers. So it's needed to clean + /* old values at first and then set a new one. */ + useEffect(() => { + for (let i=0; i<=total; i++) + onUpdateColumn(`${i}:sentence`, null, null); + onUpdateColumn(idStr, value, null); + }, [idStr]); return (