このコミットが含まれているのは:
@@ -136,7 +136,7 @@ const PostImportPage: FC<Props> = ({ user }) => {
|
||||
importStatus: previous.importStatus,
|
||||
createdPostId: previous.createdPostId,
|
||||
importErrors: previous.importErrors,
|
||||
validationErrors: row.validationErrors ?? row.errors ?? { } } : previous
|
||||
validationErrors: row.validationErrors ?? { } } : previous
|
||||
}).concat (validated.filter (row => !current.some (_1 => _1.sourceRow === row.sourceRow)))
|
||||
|
||||
const updateAttribute = async (index: number, field: string, value: string) => {
|
||||
@@ -198,12 +198,15 @@ const PostImportPage: FC<Props> = ({ user }) => {
|
||||
|
||||
const updateExisting = async (value: 'skip' | 'error') => {
|
||||
setExisting (value)
|
||||
const pendingRows = rows.map (row => row.importStatus === 'created' ? row :
|
||||
{ ...row, importStatus: 'pending' as const, importErrors: undefined })
|
||||
setRows (pendingRows)
|
||||
const generation = ++validationGeneration.current
|
||||
setLoading (true)
|
||||
try
|
||||
{
|
||||
const validated = await apiPost<{ rows: ImportRow[] }> ('/posts/import/validate',
|
||||
{ rows: rows.filter (row => row.importStatus !== 'created'), existing: value, changed_row: -1 })
|
||||
{ rows: pendingRows.filter (row => row.importStatus !== 'created'), existing: value, changed_row: -1 })
|
||||
if (generation === validationGeneration.current)
|
||||
setRows (current => mergeValidatedRows (current, validated.rows))
|
||||
}
|
||||
@@ -234,7 +237,6 @@ const PostImportPage: FC<Props> = ({ user }) => {
|
||||
return resultRow ? { ...row, importStatus: resultRow.status,
|
||||
createdPostId: resultRow.post?.id,
|
||||
importErrors: resultRow.errors,
|
||||
importStatus: resultRow.status,
|
||||
validationErrors: row.validationErrors } : row
|
||||
}))
|
||||
}
|
||||
|
||||
新しい課題から参照
ユーザをブロックする