I presume you have placed the fish with buckets? Otherwise they can despawn.
I don't have much personal experience with keeping fish but based on what I know about how to stop animals from suffocating in walls I would suggest surrounding them with waterlogged fences to keep them within the volume of water.
(Including on the bottom.)
Though fences don't look very nice, blue glass panes might be slightly less noticeable.