flatmaplatest-resubscribe-composite-key

Installation
SKILL.md

Re-subscribe on a key change, gate on a composite key

Two flows, at very different rates. One is the key — the item currently in view, changing rarely. The other is fast and continuous — a position, a size, a progress reading. Some one-shot work needs both, and needs to run once per item, not once per tick.

flatMapLatest gives the re-subscription: when the key changes, the inner collection is cancelled and rebuilt around the new key, so the pair can never mix a new key with the old stream. distinctUntilChanged over a composite of the fields that actually matter then collapses the fast stream down to "something meaningful changed":

Installs
2
GitHub Stars
35
First Seen
6 days ago
flatmaplatest-resubscribe-composite-key — maxrave-dev/kotlin-footguns