Bugs with Material Toggle Button

Dear team,

There seems to be a couple of bugs within the methods in the “Material Toggle Button” component:

  1. The onClick() method is being executed when the “.ClearSelection block” function is invoked. This causes a recursion and subsequently a stack overflow, causing the app to ANR/Crash. The expected behaviour is not to invoke the onClick() block group.

  1. The “id” attribute appears to be maintaining its own internal mapping and doesn’t reflect external changes indirectly, when “onClick” is being executed.

  2. The “isChecked” attribute returns NULL value at all times. How does one use this? (Android 10, latest Companion)

  3. The isChecked is persistently set to true when the .Click block executes, possibly based on the last action, but doesn’t seem to revert to an undefined state on function scope validity.

I think these problems would be fixed just if we take care of #1.

My use case: Wanted to create an exclusive choice picker (wherein only option can be selected). I thought of doing this as follows, but this creates a recursion due to #1:

Thanks!
Akshay
AI2 Power User

Ok, I did a few tests:

  1. Bug
  2. Bug
  3. It looks like there exits a “SingleSelection” option that I somehow missed earlier for my use-case. It looks like if this is checked (from the palette), the block returns the chosen option. A suggestion here, I’d rather prefer an array here as the return type (so that multiple values can be obtained).
  4. Bug, edge case.

Thanks!