Aurelia 2.0: Bindables do not pass their configuration as an argument to the corresponding change handler

Hello,

In supporting the bridging of binding between Aurelia 2.0 and Devextreme, I do the following (in the direction of AU→DxWidget):

propertiesChanged(bindableProp) {
    ...
    const option = Object.keys(bindableProp)[0];
    this.widgetInstance.option(option, bindableProp[option].newValue);
    ...
}

which works like a charm.

But I need to be able to filter out bindables that are value-adds (i.e. not on the widget itself but nevertheless add value to the widget through my wrapper). I was excited that I could do this:

/**
 * @type {Boolean} Convenience bindable interpreted into `activeStateEnabled`, `focusStateEnabled`, and `hoverStateEnabled`.
*/
@bindable({ mode: BindingMode.twoWay, updateWidget: false }) static = false;

where updateWidget is a custom property of my own making, the absence of which by default would be interpreted as updateWidget: true since that is the predominant case in my wrappers.

My thought was that I could do this:

propertiesChanged(bindableProp) {
    ...    
    const shouldUpdate = bindableProp.updateWidget ?? true;

    if (shouldUpdate) {        
        const option = Object.keys(bindableProp)[0];
        this.widgetInstance.option(option, bindableProp[option].newValue);
    }
    ...
}

But it looks like the bindable’s config doesn’t get passed as an argument to the change handler. This is true of individual handlers as well.

Without resorting to reflecting on the entire definition of the custom component, or calling #getBindables, is there a way to do this?

shouldnt you be able to maintain a list of what properties to pass through to the widgets? I dont think adding random properties to the bindable definition is a good idea. They couls cause conflict later when we add new properties for some core functionalities.

Yes, of course. That’s no problem.

What’s funny is that I thought I was looking at the Aurelia docs when I saw examples of custom properties on bindables. Turns out that my setting for the default tab in Chrome had reset to “AI” (I had it set to “Web”).

I guess the Aurelia team needs be aware that AI seems to think we can do that :slight_smile: ! I reached out because I thought something was missing.

Please disregard!