Setting object's transform.scale proportional to it's world position (worldTransform.position) causes "Two or more patches creating a loop" error

Hello,
I want an object’s x-scale to be proportional to its distance from the camera. The object is a cube nested under two hierarchies of null-objects: nullObject0->nullObjectCube. I’m setting it with the simple script below. I’m using nullObject.worldTransform.position to calculate the distance to camera.worldTransform.position, and then calculate a normalised “scale” value. I’m not using any patches.

When I set the nullObject0.transform.scaleX = scale I get the “two or more patches creating a loop” error. Alternatively, if I set the nested nullObject, nullObjectCube = scale it works.

Additionally, if I calculate the distance using transform (not worldTransform) it also works. E.g., this works:
const dist = Reactive.distance(camera.worldTransform.position, nullObject0.transform.position);
let scale = Reactive.sub(2,Reactive.clamp(Reactive.fromRange(dist, 1, 2), 0,1));
nullObject0.transform.scaleX = scale;

MY SCRIPT:
const Scene = require(‘Scene’);
const Reactive = require(‘Reactive’);
;(async function () { // Enables async/await in JS [part 1]
const [camera, planeTracker, nullObject0, nullCube] = await Promise.all([
Scene.root.findFirst(‘Camera’),
Scene.root.findFirst(‘planeTracker0’),
Scene.root.findFirst(‘nullObject0’),
Scene.root.findFirst(‘nullObjectCube’),

]);

//get a scalar signal “scale” as a function of distance between cube and camera
const dist = Reactive.distance(camera.worldTransform.position, nullObject0.worldTransform.position);
let scale = Reactive.sub(2,Reactive.clamp(Reactive.fromRange(dist, 1, 2), 0,1));

THIS WORKS
nullCube.transform.scaleX = scale;

THIS THROWS THE “TWO OR MORE PATCHES CREATING A LOOP” ERROR
nullObject0.transform.scaleX = scale;

})(); // Enables async/await in JS [part 2]

Alternatively, it also works (no error) if I calculate the distance using .transform, e.g.,:
const dist = Reactive.distance(camera.worldTransform.position, nullObject0.transform.position);

Screen shot shows the error when I’m using the line that throws the error: “nullObject0.transform.scaleX = scale;”

IN SUMMARY: The problem seems to be getting a signal accessed by calling .worldTransform on an object and then assigning that to a .transform property of the same object. Can anyone explain why this is the case and the general principles at play here?