material-motion-swift icon indicating copy to clipboard operation
material-motion-swift copied to clipboard

Interactions appear to be misbehaving when multiple subscriptions are made

Open jverkoey opened this issue 8 years ago • 0 comments

While implementing the visualize operator I encountered problems with some interactions behaving incorrectly when multiple subscriptions were made to the upstream.

The original implementation looked like so:

let visualizationSubscription = self.asStream().toString().dedupe().subscribeToValue { value in
  label.text = (prefix ?? "") + stringValue

  highlight.alpha = 1
  UIView.animate(withDuration: 0.3) {
    highlight.alpha = 0
  }
}

let subscription = self.asStream().subscribeAndForward(to: observer)

return {
  visualizationSubscription.unsubscribe()
  subscription.unsubscribe()
}

But this caused the contextual transition demo to behave incorrectly.

jverkoey avatar Apr 14 '17 20:04 jverkoey