Title: FirebaseListObservables always emit different element instances for unwrapped snapshots · Issue #791 · angular/angularfire · GitHub
Open Graph Title: FirebaseListObservables always emit different element instances for unwrapped snapshots · Issue #791 · angular/angularfire
X Title: FirebaseListObservables always emit different element instances for unwrapped snapshots · Issue #791 · angular/angularfire
Description: The reducers that manage a FirebaseListObservable's internal array call the unwrapMapFn utility function when emitting (see here, here, here and here). This is less that ideal, as it means that (when not preserving snapshots) the element...
Open Graph Description: The reducers that manage a FirebaseListObservable's internal array call the unwrapMapFn utility function when emitting (see here, here, here and here). This is less that ideal, as it means that (wh...
X Description: The reducers that manage a FirebaseListObservable's internal array call the unwrapMapFn utility function when emitting (see here, here, here and here). This is less that ideal, as it means that...
Opengraph URL: https://github.com/angular/angularfire/issues/791
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"FirebaseListObservables always emit different element instances for unwrapped snapshots","articleBody":"\u003c!--\r\n\r\nIMPORTANT! YOU MUST FOLLOW THESE INSTRUCTIONS OR YOUR ISSUE WILL BE CLOSED.\r\n\r\nThank you for contributing to the Firebase community!\r\n\r\nHave a usage question?\r\n=======================\r\nWe get lots of those and we love helping you, but GitHub is not the best place for them and they\r\nwill be closed. Here are some resources to get help:\r\n\r\n- Start with the README: https://github.com/angular/angularfire2\r\n- Go through the Developer's Guide: https://github.com/angular/angularfire2#developer-guide\r\n- Read the full API reference: https://github.com/angular/angularfire2/blob/master/docs/api-reference.md\r\n\r\nIf the official documentation doesn't help, try asking through our officially supported channels:\r\n\r\n- Angular Google Group: https://groups.google.com/forum/#!forum/angular\r\n- Firebase Google Group: https://groups.google.com/forum/#!forum/firebase-talk\r\n- Stack Overflow: https://stackoverflow.com/questions/tagged/angular (include the firebase and angularfire tags, too!)\r\n\r\n*Please avoid double posting across multiple channels!*\r\n\r\nThink you found a bug?\r\n=======================\r\nYeah, we're definitely not perfect! Please use the bug report template below and include a minimal\r\nrepro when opening the issue.\r\n\r\nHave a feature request?\r\n========================\r\nGreat, we love hearing how we can improve our products! Remove the template below and\r\nprovide an explanation of your feature request. Provide code samples if applicable. Try to\r\nthink about what it will allow you to do that you can't do today? How will it make current\r\nworkarounds straightforward? What potential bugs and edge cases does it help to avoid?\r\n\r\n--\u003e\r\n\r\nThe reducers that manage a `FirebaseListObservable`'s internal array call the `unwrapMapFn` utility function when emitting (see [here](https://github.com/angular/angularfire2/blob/2.0.0-beta.7/src/database/firebase_list_factory.ts#L140), [here](https://github.com/angular/angularfire2/blob/2.0.0-beta.7/src/database/firebase_list_factory.ts#L151), [here](https://github.com/angular/angularfire2/blob/2.0.0-beta.7/src/database/firebase_list_factory.ts#L16) and [here](https://github.com/angular/angularfire2/blob/2.0.0-beta.7/src/database/firebase_list_factory.ts#L173)).\r\n\r\nThis is less that ideal, as it means that (when not preserving snapshots) the elements in the emitted arrays will always be different object instances between emissions. That does not play nice with Angular's `OnPush` change detection - which takes advantage of unchanged object references - and always emitting different objects incurs a significant performance penalty.\r\n\r\n### Version info\r\n\r\n\u003c!-- What versions of the following libraries are you using? Note that your issue may already\r\nbe fixed in the latest versions. --\u003e\r\n\r\n**Angular:** 2.4.5\r\n\r\n**Firebase:** 3.4.0 (for Plunker compatibility)\r\n\r\n**AngularFire:** 2.0.0-beta.7\r\n\r\n### How to reproduce these conditions\r\n\r\nThere is a plunk [here](https://plnkr.co/edit/7lIqBkNUovqQERwB0N1o).\r\n\r\n**Steps to set up and reproduce**\r\n\r\nSee plunk above. To see the difference in performance:\r\n\r\n* run the plunk\r\n* wait for the lists to start rolling (they should roll alternately, every second)\r\n* open up the dev tools and record a profile\r\n* wait for a few seconds, allowing each list to roll several times\r\n* stop the profiling\r\n* look at the flame graph, noting the performance difference between the preserved (fast) and unwrapped (slow) change detection and DOM updates\r\n\r\n### Expected behavior\r\n\r\nThe arrays emitted by lists that unwrap snapshots should use the same unwrapped object for array elements that have not changed.\r\n\r\n### Actual behavior\r\n\r\nEach time arrays of unwrapped snapshots are emitted by lists, the array elements are always different object instances - even if the elements have not actually changed.","author":{"url":"https://github.com/cartant","@type":"Person","name":"cartant"},"datePublished":"2017-01-26T02:14:38.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/791/angularfire/issues/791"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:1c9a9a5e-0fae-6872-1f3c-34adc9a5ae8a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8096:1BDA3B:35273:47A4D:6A5B50DB |
| html-safe-nonce | e04c01b7e3d281a9525f40fe18425101f3be72af16f4e8a1b50c6a3581988298 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MDk2OjFCREEzQjozNTI3Mzo0N0E0RDo2QTVCNTBEQiIsInZpc2l0b3JfaWQiOiI1OTI1NTMxNTE0MDgzOTU0OTA3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | f5024e892b3413573d01c2382aa087fec79f1354925c9b7544bf1d148e823fe2 |
| hovercard-subject-tag | issue:203277292 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angularfire/791/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0c46bb3973d28354d971d3d9db6ca5ab590d136d50cb4c756666f8bda6a4909d/angular/angularfire/issues/791 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0c46bb3973d28354d971d3d9db6ca5ab590d136d50cb4c756666f8bda6a4909d/angular/angularfire/issues/791 |
| og:image:alt | The reducers that manage a FirebaseListObservable's internal array call the unwrapMapFn utility function when emitting (see here, here, here and here). This is less that ideal, as it means that (wh... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | cartant |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5290d7e14309ad1e76106a9c4237bd1041517e83ea182c8ab756752cb0c6940b |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angularfire git https://github.com/angular/angularfire.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 49453413 |
| octolytics-dimension-repository_nwo | angular/angularfire |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49453413 |
| octolytics-dimension-repository_network_root_nwo | angular/angularfire |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9c975978430e9ad293956f2bbdaf153b1bd84a99 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width