xoidlabs / xoid

Framework-agnostic state management library designed for simplicity and scalability ⚛
https://xoid.dev
MIT License
158 stars 7 forks source link

Fix mapped unsubscribe affecting other subscribers #15

Closed appden closed 1 year ago

appden commented 1 year ago

This fixes an issue where if a mapped atom is subscribed multiple times, then unsubscribed by one, it would effectively unsubscribe the others because the listener callback would only get added to the parent atom's listener set once. Now it'll only get removed if there are no subscribers to the derived atom remaining.

appden commented 1 year ago

Hi @onurkerimov, following up on this fix. Thanks!

onurkerimov commented 1 year ago

Just released 1.0.0-beta.8 on npm, including these changes 👍. Thank you, great addition as always!