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]);
|
}, [errorLoadText, params.productId, isDraft, isReview]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!product?.subCategory?.id || product.subCategory.category?.name) {
|
const subCategoryId = product?.subCategory?.id;
|
||||||
|
|
||||||
|
if (!subCategoryId || product?.subCategory?.category?.name) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,7 +196,7 @@ function ProductDetailPageInner() {
|
|||||||
const rows: CategoryOption[] = Array.isArray(subcategoriesJson?.rows)
|
const rows: CategoryOption[] = Array.isArray(subcategoriesJson?.rows)
|
||||||
? subcategoriesJson.rows
|
? subcategoriesJson.rows
|
||||||
: [];
|
: [];
|
||||||
if (rows.some((subCategory) => subCategory.id === product.subCategory?.id)) {
|
if (rows.some((subCategory) => subCategory.id === subCategoryId)) {
|
||||||
if (!cancelled) {
|
if (!cancelled) {
|
||||||
setResolvedMainCategoryName(category.name);
|
setResolvedMainCategoryName(category.name);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -133,11 +133,12 @@ interface CompareRow {
|
|||||||
function hasChangesForPaths(rows: CompareRow[], paths: string[]) {
|
function hasChangesForPaths(rows: CompareRow[], paths: string[]) {
|
||||||
return rows.some((row) => {
|
return rows.some((row) => {
|
||||||
if (!row?.field || row.isUpdate !== true) return false;
|
if (!row?.field || row.isUpdate !== true) return false;
|
||||||
|
const field = row.field;
|
||||||
return paths.some(
|
return paths.some(
|
||||||
(path) =>
|
(path) =>
|
||||||
row.field === path ||
|
field === path ||
|
||||||
row.field.startsWith(`${path}.`) ||
|
field.startsWith(`${path}.`) ||
|
||||||
row.field.startsWith(`${path}[`)
|
field.startsWith(`${path}[`)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user