mikkopaderes / ember-cloud-firestore-adapter

Unofficial Ember Data Adapter and Serializer for Cloud Firestore
MIT License
69 stars 17 forks source link

Add onUpdate Callback to adapterOptions for Real-Time Data Updates #323

Open AmilKey opened 4 months ago

AmilKey commented 4 months ago

Is your feature request related to a problem? Please describe. I'm always frustrated when trying to use queries with isRealtime: true in services where the results are transformed into another array. The issue is that there is no trigger or callback for when onSnapshot updates occur, making it difficult to manage real-time data updates outside of a route.

Describe the solution you'd like I would like to have a callback or trigger that fires whenever onSnapshot updates occur while using queries with isRealtime: true in services. This could be added to adapterOptions as an onUpdate callback, allowing us to handle real-time updates more effectively in different parts of the application, not just within a router.

adapterOptions: {
  isRealtime: true,
  onUpdate() {
    // trigger when collection is updated
  }
}