Only do this when the visibility has actually changed.