Thanks for the quick reply. No cache on preview makes sense. One cache per shortcode should be okay. Will follow up once published if API requests are higher than expected.
Update the line 22 in footer.php to:
$post_datetimes = $wpdb->get_row($wpdb->prepare("SELECT YEAR(min(post_date_gmt)) AS firstyear, YEAR(max(post_date_gmt)) AS lastyear FROM $wpdb->posts WHERE post_date_gmt > 1970", null));
Basically, add ,null to send a null parameter as the second argument of the prepare function.