Renaming a Hub Variable for Disabled App will not change the app's settings

I had a global variable defined that I renamed. Afterwards I was changing a couple rules, one of those rules was disabled, I activated it to make the change and noticed that the global variable in that rule did not get renamed. Seems like, just because a rule is disabled, it should still be renamed to avoid errors when the rule is turned back on.

1 Like

Disabling an app prevents all app code from running. The "handler" (callback) for a hub variable being renamed is part of the app code. As nice as it would be, I'm not sure there is a way around this -- other than that if you want a less extreme option, pausing the rule, stopping the rule, or using a required expression or other feature to automate some modified rule behavior instead of disabling it might be a better approach.

(This is a general app issue, not Rule Machine specifically.)

Well it shows all the rules in use when you go to rename. Maybe a warning and some indications of disabled rules in case one forgot about it?

2 Likes

Right, the variable reference is "registered" by the app when the variable is used. That does not require any app code to run to retrieve; it's explicitly created by the app at some point in time (as opposed to being, say, something the hub has to run app code to fetch). An app can also technically use a hub variable without registering, and then you won't see it here, but this is bad practice and not something you should find in, at least, any built-in app (only such apps will be notified when renames happen, but again, that part requires the app to be able to run to execute this method).

A note could be added to the documentation?

Note that these callbacks are available to any app (though, of course, not every app can or does use hub variables), and the behavior of disabled apps is identical across all apps. This isn't specific to Rule Machine.

1 Like

Everything that @bertabcd1234 has said above is exactly right.

There's no bug here, this works exactly the way it is designed to work. As it stands, I don't see an issue that warrants adding a warning to Hub Variables about disabled apps. At the point that a user is renaming Hub Variables used in multiple apps, and disabling apps, that user has become a sophisticated enough user to not need a warning, especially for anyone who reads this thread.

1 Like

Any app can use a variable if the variable is set to be a connector, as it just becomes a device with a variable attribute.

Yes, that is consistent with what I said. Connectors are just devices as far as any app is concerned, so they are largely irrelevant to this discussion.

Additionally, there are multiple types of connectors, and the one you allude to, "Variable," is only one kind. Further, it is not true that any app can use them; like with any device, the app needs to specifically allow that particular kind of device, just as it could specifically allow variables or certain kinds of variables (just in this case, it doesn't need to know that it's "connected" to a variable under the hood).

As a related note: in general, I would also not recommended connector usage over direct variable usage now that the latter is possible (it wasn't always, and this was a workaround; now apps at least can).

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.