Interference between same CC on different Midi Devices

Hi!
I have a variable switching tabs visibility. It does that by incoming Midi CC messages.
This is a simplified version of it

onValue:
if (value[1]===127) {
set("panel_main", 0)
}
else if (value[1]===8) {
set("panel_main", 1)
}

The issue I'm having is that if I then create a button widget nested in one of the tabs that have the same CC of one of these conditions (example CC 8), even though the midi target is different, it seems that it's not being differentiated and breaks the visibility behavior. Is there a way to solve this? I've tried several methods, around filtering value[1] to the specific midi device, but no luck... probably because of error coding it.

Thank you

hi,

would you mind providing your json sesion file ?

Shure, here it is.
I've stripped the tab's
Forum_Example.json (16.4 KB)
content to facilitate debugging. I left the button in tab 3 that (in this example) is causing the issue. Changing the preArgs from cc8 to any other that is not present on the variable_AppTracker solves the issue. Changing the channel from 1 to any other also solves. The issue is when using the same channel and cc on different midi devices.

Thanks

Thank you for the file. This problem outlines a limitation in the way osc messages are dispatched by the client : for a given address, widgets with the highest number of matching preArgs consume the message and prevent it from reaching other widgets with less or zero preArgs (and this happens before the midi target is checked). In a way preArgs are considered as an extension of the address and that's why I came up with this policy, it appears a little bit problematic with midi messages given that there are only a few possible addresses for potentially distinct usages.

I'll need some time to think about how to fix this properly, I'll keep you posted. Meanwhile you should be able to circumvent the issue by replacing variable_AppTracker with a single variable/script widget per control change (with preArgs) so that it doesn't conflict with the button.

Thank you Jean for your explanation, and for the alternative suggestion. As there will be potentially hundreds of CC being tracked, it will probably not be the most efficient way to solve this. I'll just change the incoming message to something like channel 16, leaving other channels reserved for the rest of the template. That will probably give me ample space to move around. Looking forward to further updates!

Cheers!