Gutenberg – render_callback does not pass ToggleControl value on frontend

Really having to have this fixed, I used this not-so-elegant workaround that works perfectly. It is bound to the base-name I use for my blocks:

add_filter('render_block_data', function($parsed_block, $source_block, $parent_block) {
  if(strpos($parsed_block['blockName'], 'my-base-name/') !== false && isset($parsed_block['attrs']) && is_array($parsed_block['attrs'])) {
    
    foreach($parsed_block['attrs'] as $key => $val) {

        if($val === true) {
            $parsed_block['attrs'][$key] = '1';    
        }
        elseif($val === false) {
            $parsed_block['attrs'][$key] = '';    
        }        
    } 
  }

  return $parsed_block;
}, 10, 3);