Commit Graph
2 Commits
Author SHA1 Message Date
zstadlerandClaude 28917685f7 Fix map staying blank until moved (#2217)
If the style arrives before the map's initial `style.load`,
`componentDidUpdate` skips `setStyle` because `state.map` is still null.
The `setState` on `style.load` is then blocked by
`shouldComponentUpdate`, because `JSON.stringify` throws on the MapLibre
`Map` in state, so the style is only applied after a later prop change,
e.g. moving the map.

Fix: `shouldComponentUpdate` compares state fields by reference instead
of stringifying them. `zoom` is excluded: it changes on every zoom frame
but is only read when a layer popup opens.

## Launch Checklist

 - [x] Briefly describe the changes in this PR.
 - [ ] ~~Link to related issues.~~
- [ ] ~~Include before/after visuals or gifs if this PR includes visual
changes.~~
 - [ ] ~~Write tests for all new functionality.~~ (removed per review)
 - [x] Add an entry to `CHANGELOG.md` under the `## main` section.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01WDkBFXcoMv8K4QSHA6P3Fg


---
_Generated by [Claude Code](https://claude.ai/code)_

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-11 17:06:18 +03:00
zstadler 577663f706 Resolve #821 (#822)
Please see code analysis at
https://github.com/maputnik/editor/issues/821#issuecomment-1772360990
2023-10-20 11:01:20 -04:00