I have three runtime properties across two data sources. They are only used in the script of a coded component.
App Health reports them as unused and recommends deleting them. “Find references” also shows that they are never used.
I assumed I could trust the information in App Health and deleted them, but this broke critical parts of my app. There was also no warning on deletion that they were in use.
Steps to reproduce:
Create a runtime property on a data source.
Use it only in the script of a coded component.
Open App Health, or run “Find references” on the property.
I followed my own reproduction steps in a different solution and wasn’t able to reproduce it there either, so I did a deep dive into the Appfarm AI-generated JS in my coded component.
I found why it wasn’t detected, but I’m not sure whether this is intended behaviour from Appfarm or not.
The difference:
Not detected – the record is wrapped in another object and the property is read through the wrapper:
const wrapped = appfarm.data.items.get().map(it => ({ ref: it }));
wrapped.forEach(w => console.log(w.ref.propA));
Detected – the property is read directly on the record:
So usage only seems to be detected when the property is accessed directly on the record returned from appfarm.data..get(), not when the record is aliased inside another object. I guess it makes sence.
While digging into this I also found a different bug in the detection of runtime properties:
If I have a runtime property (prop 1) on a data source, and prop 1 is only used inside the function that defines a second runtime property (prop 2) on the a different data source, then prop 1 is not detected as in use, neither in App Health nor in Find References.
Thanks! I was able to reproduce this one too and have filed a bug report for it. I can’t say yet when it will be fixed, but we’ll update this post once it is.