Skip to content

[BUG] References to $(this:page)/etc. in action store-result fields aren't recalculated when the containing button is moved #4192

@jswalden

Description

@jswalden

Make sure you're on the latest stable or beta build

  • I have tested this on the latest stable or beta release

Is this a bug in companion itself or a module?

  • I believe this to be a bug in companion and not a specific module

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

This is followup to #4065, discovered while implementing an optimization to that scheme.

If you specify isInverted while referring to $(this:column) or other location-related variables, moving a button around will cause the isInverted computed value to be updated. I believe this is because of a control.triggerLocationHasChanged() call in the controls tRPC router for moveControl or swapControl, and its implementation through ButtonControlBase.triggerLocationHasChanged will perform this.entities.resubscribeEntities(EntityModelType.Feedback, 'internal').

But if you specify storeResult while referring to $(this:column) or other location-related variables -- for example, by specifying a location of $(this:page)/$(this:row)/$(this:column):

Image

and then you move a button containing such action around, nothing in particular causes the storeResult value to be recalculated. (Obviously, resubscribing internal feedbacks won't affect any actions!) And so it will remain stale, computing the old value. And in the above case, the store will fail because the local variable won't exist on the old button (unless the user recreates it).

Steps To Reproduce

No response

Expected Behavior

ButtonControlBase.triggerLocationHasChanged needs to trigger recalculation of any storeResult information, on entity move, if any storeResult info depends on location-related variables.

This presumably could be done by adding this.entities.resubscribeEntities(EntityModelType.Action), but that's going to entail double-looping over all entities and avoidable extra work. Maybe the onlyType/onlyConnectionId scheme ought be converted to a user-supplied function filter mechanism instead?

Environment (please complete the following information)

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    BUGSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions