Commit 232593c
Fix black flash when removing/re-adding annotations (#12326)
## Summary
- Fixes
[MAPSIOS-2180](https://mapbox.atlassian.net/browse/MAPSIOS-2180):
Verizon reported a black flash when removing/re-adding polygon
annotations (regression in v11.17.0).
- Root cause: `removeGeoJSONSourceFeatures` is async (worker thread)
while `setLayerProperties` is sync (immediate). When annotations were
cleared, `syncLayer()` reset data-driven properties to literal style
defaults (e.g. `fill-color: #000000`) before features were actually
removed from the source — so for 1+ frames the still-visible features
rendered with the black default.
- Fix: in the "unused properties" reset path in `syncLayer()`, swap the
literal style default for a coalesce expression that reads each
feature's own stored value first (with the style default as fallback).
Stale features waiting on the async remove now keep their correct
colors; no black flash.
### Why minimal
A broader architectural refactor (coalesce expressions set once, manager
values merged into features, static data-driven/non-data-driven key sets
via stylegen) was prototyped and reviewed but carries meaningful scope
and risk for a hotfix affecting all annotation users and every
downstream (Flutter SDK, Nav SDK). Tracked as a follow-up in
[MAPSIOS-2185](https://mapbox.atlassian.net/browse/MAPSIOS-2185).
## Test plan
- [x] Unit tests: `AnnotationManagerImplTests` + all four
`*AnnotationManagerTests` suites pass locally on iPhone 16 Pro / iOS
18.6.
- [x] Run the `PolygonAnnotationExample` reproducer (rapid remove/re-add
cycle) — confirm no black flash.
- [ ] Verify polygon renders correctly after re-add (fill-color,
fill-opacity, fill-outline-color).
- [ ] Test with manager-level properties (e.g.
`polygonAnnotationManager.fillOpacity = 0.5`).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
[MAPSIOS-2180]:
https://mapbox.atlassian.net/browse/MAPSIOS-2180?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
[MAPSIOS-2185]:
https://mapbox.atlassian.net/browse/MAPSIOS-2185?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
cc @mapbox/maps-ios
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
GitOrigin-RevId: 0ffd039c5f6f563ededf18443e1b11c9695ad8051 parent 8fdd1fb commit 232593c
10 files changed
Lines changed: 621 additions & 213 deletions
File tree
- Sources/MapboxMaps/Annotations
- Tests/MapboxMapsTests/Annotations
- Generated
Lines changed: 31 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
83 | 90 | | |
84 | 91 | | |
85 | 92 | | |
| |||
289 | 296 | | |
290 | 297 | | |
291 | 298 | | |
292 | | - | |
293 | | - | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
294 | 306 | | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | 307 | | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
305 | 311 | | |
306 | | - | |
| 312 | + | |
307 | 313 | | |
308 | 314 | | |
309 | | - | |
| 315 | + | |
| 316 | + | |
310 | 317 | | |
311 | 318 | | |
312 | 319 | | |
313 | 320 | | |
314 | 321 | | |
315 | | - | |
316 | 322 | | |
| 323 | + | |
317 | 324 | | |
318 | 325 | | |
319 | 326 | | |
| |||
331 | 338 | | |
332 | 339 | | |
333 | 340 | | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
334 | 351 | | |
335 | 352 | | |
336 | 353 | | |
| |||
Lines changed: 66 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
212 | | - | |
| 212 | + | |
| 213 | + | |
213 | 214 | | |
214 | 215 | | |
215 | 216 | | |
216 | 217 | | |
217 | 218 | | |
218 | 219 | | |
219 | 220 | | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
220 | 285 | | |
221 | 286 | | |
222 | 287 | | |
| |||
Lines changed: 48 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments