I’m getting a new JS Error in ACF (FREE) 5.8.6 related to a map Zoom value.
My map field is created with PHP using the following code:
array (
'key' => 'field_5918c49e15770',
'label' => __('Model Location', 'wp3d-models'),
'name' => 'model_location_noapi',
'type' => 'google_map',
'required' => 1,
'conditional_logic' => array (
'status' => 1,
'rules' => array (
array (
'field' => 'field_587557a304734',
'operator' => '!=',
'value' => 'custom_option',
),
array (
'field' => 'field_5917bf8a1589c',
'operator' => '==',
'value' => 'custom_address',
),
),
'allorany' => 'all',
),
'center_lat' => '37.386051',
'center_lng' => '-122.083855',
'zoom' => '',
'height' => '',
),
The issue relates to a JS error of:
Uncaught TypeError: Cannot read property 'zoom' of null
(Screenshot Attached)
If I revert back to 5.8.5, the issue is not present.
I dug a little deeper into the most recent changes to the ‘acf-input.js’ file and, specifically the ‘zoom’ changes in the last version:
https://github.com/AdvancedCustomFields/acf/commit/ef5555c494baca8709aae0f718cb2e78b39025e7#diff-d6a7201ab49b2683e384e4910468064eR6197
I’m no JS expert, but my guess is that passing in an empty value for ‘zoom’ (from my PHP code) is causing an issue after the recent changes from ‘zoom’ to ‘val.zoom’. Maybe?
For what it is worth, the latest version of ACF PRO 5.8.6 doesn’t seem to have the same problem.
Anyone else seeing something similar? Hoping for a quick fix in 5.8.7. 🙂