Add null guards for getElementById and uploadDetail in UploadPage

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-09 17:23:31 +08:00
parent 3ad898aaab
commit 08d7402918

View File

@@ -452,6 +452,7 @@ onMounted(async () => {
(newValue) => {
if (newValue) {
const inputElement = document.getElementById("fileNameInput");
if (!inputElement) return;
const baseWidth = 20;
const textWidth = getTextWidth(fileName.value, inputElement);
inputElement.style.width = baseWidth + textWidth + "px";
@@ -461,10 +462,12 @@ onMounted(async () => {
);
showEdit.value = true;
if (uploadId.value) await filesStore.getUploadDetail();
selectedColumns.value = Array.from(
{ length: uploadDetail.value.columns.length },
() => columnType[columnType.length - 1],
); // Default to "Not Assigned"
if (uploadDetail.value?.columns) {
selectedColumns.value = Array.from(
{ length: uploadDetail.value.columns.length },
() => columnType[columnType.length - 1],
); // Default to "Not Assigned"
}
unwatch();
isLoading.value = false;
});