From 97903f756a2bc5af18cb49dba98943d1cc6af889 Mon Sep 17 00:00:00 2001 From: Doxa Maps Date: Mon, 28 Sep 2026 06:55:35 +0000 Subject: [PATCH] Country posters: pre-warm skips only paints that already read the feature An array is not the same as data-driven: a zoom-only interpolate is an array and still compiles a variant on the first gesture. The warm-up now leaves alone only values that read a feature property, and wraps constants and zoom-only expressions. --- plugin-designs/country-posters/countries-map.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugin-designs/country-posters/countries-map.vue b/plugin-designs/country-posters/countries-map.vue index 1da70ca9d..ca90ef275 100644 --- a/plugin-designs/country-posters/countries-map.vue +++ b/plugin-designs/country-posters/countries-map.vue @@ -1431,10 +1431,14 @@ async function ensureRegionsLoaded() { // compile (rega on research-map: 5.5 s MapLibre / 11.1 s Mapbox under SwiftShader). Painting each // current value through a case with two identical branches keeps the look and moves the compile // off the gesture. All three, or the other two still compile on the click (simpleresearch). + // "Already data-driven" means the value READS THE FEATURE somewhere, not merely that it is an + // array: a zoom-only interpolate is an array and still compiles a variant on the first gesture + // (simpleresearch). Anything keyed on a feature is left exactly as the layer wrote it. + const readsFeature = (e) => Array.isArray(e) && (e[0] === 'get' || e[0] === 'has' || e[0] === 'feature-state' || e.some(readsFeature)) for (const [layer, prop] of [['regions-fill', 'fill-opacity'], ['regions-border', 'line-color'], ['regions-border', 'line-width']]) { try { const v = map.value.getLayer(layer) && map.value.getPaintProperty(layer, prop) - if (v != null && !Array.isArray(v)) { + if (v != null && !readsFeature(v)) { map.value.setPaintProperty(layer, prop, ['case', ['in', ['get', 'iso_3166_1_alpha_3'], ['literal', []]], v, v]) } } catch (_) { /* a style without the layer: nothing to warm */ }