I am not sure I understand how you expect it to work. The code you have shared looks fine, my only concern with it is that it is only triggered on change of the radio groups, with no handling of initial value or loading experience.
Can you share the full setup / code?