fix: variable shadowing silently drops object label updates (#22472)

When an existing tracked object's label or stationary status changes
(e.g. sub_label assignment from face recognition), the update handler
declares a new const newObjects that shadows the outer let newObjects.

The label and stationary mutations apply to the inner copy, but
handleSetObjects on line 148 reads the outer variable which was never
mutated. The update is silently discarded.

Remove the inner declaration so mutations apply to the outer variable
that gets passed to handleSetObjects.
This commit is contained in:
ryzendigo
2026-03-16 20:43:25 +08:00
committed by GitHub
parent bc29c4ba71
commit dfc6ff9202

View File

@@ -125,8 +125,6 @@ export function useCameraActivity(
newObjects = [...(objects ?? []), newActiveObject];
}
} else {
const newObjects = [...(objects ?? [])];
let label = updatedEvent.after.label;
if (updatedEvent.after.sub_label) {