From a0746a06379962351ad45fe97e24fbc9ec53db63 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 11 Oct 2026 16:15:31 +0300 Subject: [PATCH] Fix shouldComponentUpdate blocking state updates 1. shouldComponentUpdate compares state fields by reference instead of JSON.stringify, which threw on the MapLibre Map in state and blocked every state update 2. The skipped update after style.load left the map on the initial empty style until a prop changed, e.g. by moving the map 3. Remove the setStyle call on style.load added earlier in this PR 4. zoom is excluded from the comparison: it is set on every zoom frame but only read when a layer popup opens, and React keeps this.state.zoom current without a re-render 5. Including zoom would run componentDidUpdate (a setStyle diff) on every zoom frame: 69 instead of 3 calls in a short zoom test 6. Risk: future code reading state.zoom in render or componentDidUpdate will not refresh on zoom Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01WDkBFXcoMv8K4QSHA6P3Fg --- src/components/MapMaplibreGl.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/MapMaplibreGl.tsx b/src/components/MapMaplibreGl.tsx index 5d81b499..f86d8fd4 100644 --- a/src/components/MapMaplibreGl.tsx +++ b/src/components/MapMaplibreGl.tsx @@ -107,7 +107,7 @@ class MapMaplibreGlInternal extends React.Component key !== "zoom" && this.state[key] !== nextState[key]); } catch(_e) { // no biggie, carry on } @@ -236,7 +236,6 @@ class MapMaplibreGlInternal extends React.Component {