Skip to content

Make InfoBubble follow the marker's icon and keep its entry stable - #10

Merged
wf9a5m75 merged 1 commit into
developfrom
fix/infobubble-content
Nov 7, 2026
Merged

wf9a5m75 merged 1 commit into
developfrom
fix/infobubble-content

Conversation

@wf9a5m75

@wf9a5m75 wf9a5m75 commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Compose already re-ran the content lambda, so content and colours followed. What did not follow was the marker's icon: InfoBubble(marker) registered in DisposableEffect(marker), so after marker.icon was replaced the bubble stayed placed for the old icon's size (doubling the icon put the bubble over the pin).

The three overloads now share a private RegisterInfoBubble: the entry is remembered on where it is shown (marker or position, icon, tailOffset) and replaced only when one of those changes; the content calls the latest lambda via rememberUpdatedState; disposal removes only the entry it added. API dump unchanged.

Tests: InfoBubbleRegistrationTest (4) on a UI-less Applier; the icon test fails on the old code. Adds kotlinx-coroutines-test as a test dependency. Device (Lenovo tablet, MapLibre): after doubling the icon the bubble now moves above the larger pin.

InfoBubble(marker) and InfoBubbleCustom registered the entry built on
first composition inside DisposableEffect(marker) (Custom: marker,
tailOffset). The entry's icon is a value, so swapping marker.icon left
the bubble placed for the old icon: a pin scaled 2x was drawn over by its
own bubble.

All three overloads now go through RegisterInfoBubble: the entry is
remembered on what decides where the bubble goes (anchor, icon,
tailOffset) and is swapped only when one of those changes; its content
reads the latest lambda through rememberUpdatedState, so content and
colours follow without touching bubbleFlow. Disposal removes only the
entry this call put there.

Adds a JVM unit test that runs the Compose runtime on a no-node applier
(kotlinx-coroutines-test for Main, isReturnDefaultValues for
android.os.Trace).
@wf9a5m75
wf9a5m75 merged commit 1034c73 into develop Nov 7, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant