Yes, optics, because if the US sinks ships carrying solar panels they lose even more respect on the international stage and bring even more attention to their illegal military blockade of Cuba in which they have directly killed over 200 civilians via bombing vessels in and around Cuba, and indirectly killed at least a few thousand by eliminating oil imports to the country.
China had nothing but risk before the carrier group was moved into place, as the US' official stance was international sanctions and complete lockout from using USD internationally if you dared to trade with Cuba.
After the blockade those sanctions are meaningless as no other country would follow the US if they actually issue said sanctions, and the US itself isn't economically capable of handling sanctions against China at this point in time. So China has no risk to help out.