fix: fix the logical error in the null/empty check for the polygons parameter

This commit is contained in:
ZhaiSoul 2025-11-05 13:56:51 +00:00
parent 303ebff4e3
commit 54f228fb6f

View File

@ -262,7 +262,7 @@ export function PolygonCanvas({
};
useEffect(() => {
if (activePolygonIndex === undefined || !polygons) {
if (activePolygonIndex === undefined || !polygons?.length) {
return;
}
@ -270,7 +270,7 @@ export function PolygonCanvas({
const activePolygon = updatedPolygons[activePolygonIndex];
// add default points order for already completed polygons
if (!activePolygon?.pointsOrder && activePolygon?.isFinished) {
if (!activePolygon.pointsOrder && activePolygon.isFinished) {
updatedPolygons[activePolygonIndex] = {
...activePolygon,
pointsOrder: activePolygon.points.map((_, index) => index),