Fix TypeScript build errors in product detail and admin review
This commit is contained in:
@ -168,7 +168,9 @@ function ProductDetailPageInner() {
|
||||
}, [errorLoadText, params.productId, isDraft, isReview]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!product?.subCategory?.id || product.subCategory.category?.name) {
|
||||
const subCategoryId = product?.subCategory?.id;
|
||||
|
||||
if (!subCategoryId || product?.subCategory?.category?.name) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -194,7 +196,7 @@ function ProductDetailPageInner() {
|
||||
const rows: CategoryOption[] = Array.isArray(subcategoriesJson?.rows)
|
||||
? subcategoriesJson.rows
|
||||
: [];
|
||||
if (rows.some((subCategory) => subCategory.id === product.subCategory?.id)) {
|
||||
if (rows.some((subCategory) => subCategory.id === subCategoryId)) {
|
||||
if (!cancelled) {
|
||||
setResolvedMainCategoryName(category.name);
|
||||
}
|
||||
|
||||
@ -133,11 +133,12 @@ interface CompareRow {
|
||||
function hasChangesForPaths(rows: CompareRow[], paths: string[]) {
|
||||
return rows.some((row) => {
|
||||
if (!row?.field || row.isUpdate !== true) return false;
|
||||
const field = row.field;
|
||||
return paths.some(
|
||||
(path) =>
|
||||
row.field === path ||
|
||||
row.field.startsWith(`${path}.`) ||
|
||||
row.field.startsWith(`${path}[`)
|
||||
field === path ||
|
||||
field.startsWith(`${path}.`) ||
|
||||
field.startsWith(`${path}[`)
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user