I encountered a TypeError message, even though my application seems to be functioning properly.
"ERROR TypeError: Cannot read property 'replace' of null"
I'm struggling to understand how to fix this issue. Can someone provide me with some guidance or help me comprehend why this error is occurring? https://i.stack.imgur.com/KIyw6.png
if (isInitial) {
// Add Data Rows (initially)
for (const row of rows) {
const clientVisitGuid = row[2];
const location = row[3];
row[5] = row[5].replace(/\//g, '\/\u200B');
const service = row[5];
const rowId = `${service || 'zzz'}_${location}_${clientVisitGuid}`;
const sortString = `${service || 'zzz'}_${location}_${clientVisitGuid}`;
const daysPastDischarge = parseInt(row[6]);
const isMarked = parseInt(row[7]) === 1 ? true : false;
if (cbt.hasBodyRow(rowId) === false) {
const values: Array<[string, string | number]> = [];
let isAllClear = true;
for (let i = 0; i < row.length; i++) {
const colId: string = cbt.headerRow.headerCols[i].id;
const colVal: string | number = row[i];
if (cbt.headerRow.headerCols[i].isFlag === true && colVal !== 1) {
isAllClear = false;
}
values.push([colId, colVal]);
}
const valueHash = hash(JSON.stringify(row));
cbt.addBodyRow(
rowId,
values,
valueHash,
sortString,
daysPastDischarge,
isMarked,
isAllClear,
true,
);
}
}
}