Skip to content

PointAnnotationManager.update() breaks click handlers on updated annotations #1026

@samstamper33

Description

@samstamper33

After calling PointAnnotationManager.update() on a PointAnnotation, that specific annotation loses its ability to receive click events through the registered click listener. The annotation remains visually present on the map but becomes unresponsive to user taps.

Environment:

Flutter version: 3.32.7
mapbox_maps_flutter version: 2.10.0
Platform: iOS
Minimum reproduction: Any app using PointAnnotations with click listeners

Steps to Reproduce:

Create a PointAnnotation and add it to a PointAnnotationManager
Register a click listener using addOnPointAnnotationClickListener()
Click the annotation - it responds correctly
Call mapPointAnnotationManager.update(annotation) with modified properties (e.g., iconSize, iconImage)
Attempt to click the same annotation again

Expected Behavior:

The annotation should remain clickable after being updated.

Actual Behavior:

The annotation becomes unresponsive to click events. The click listener is no longer triggered for that specific annotation.
Code Sample:

dart// This works the first time
annotation.iconImage = "selected_icon";
annotation.iconSize = 0.5;

// After this call, the annotation loses click responsiveness
await mapPointAnnotationManager?.update(annotation);

// Subsequent clicks on this annotation are ignored

Additional Context:

Other annotations remain clickable
The issue persists across both deprecated OnPointAnnotationClickListener and newer tapEvents APIs
Visual updates are applied correctly - only click handling is affected
Tested on multiple devices with consistent reproduction

I recently updated from 0.4.4, so very likely user error, but I've been messing around with this for a few hours without success now. Removing the .update() function has it working correctly but without updating the size or icon

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions