Although not documented we actually do pass recordArray to adapter.query as a last arg
Options:
cc @bmac / @fivetanley / @igorT
Looking of uses in the wild. It looks like the firebase adapter uses it https://github.com/firebase/emberfire/blob/3e5cef6cb2e73c7427f82b529a624e37bcf0d5a1/addon/adapters/firebase.js#L264
I searched all of the adapters in emberobserver https://emberobserver.com/categories/ember-data-adapters and I found the firebase adapter is the only adapter that uses the recordArray argument.
| Adapter Name | Repo | Uses hidden recordArray argument? |
| --- | --- | --- |
| ember-local-storage | https://github.com/funkensturm/ember-local-storage | No |
| ember-graphql-adapter | https://github.com/alphasights/ember-graphql-adapter/ | No |
| ember-airtable | https://github.com/benoror/ember-airtable/ | No |
| ember-django-adapter | https://github.com/dustinfarris/ember-django-adapter | No |
| emberfire | https://github.com/firebase/emberfire | Yes |
| ember-pouch | https://github.com/nolanlawson/ember-pouch | No |
| ember-flexberry-data | https://github.com/Flexberry/ember-flexberry-data | No |
| ember-localstorage-adapter | https://github.com/locks/ember-localstorage-adapter | No |
| herd-ember | https://github.com/herdup/herd-ember | No |
| active-model-adapter | https://github.com/ember-data/active-model-adapter | No |
| ember-localforage-adapter | https://github.com/genkgo/ember-localforage-adapter | No |
| ember-data-hal-9000 | https://github.com/201-created/ember-data-hal-9000 | No |
| ember-data-tastypie-adapter | https://github.com/escalant3/ember-data-tastypie-adapter | No |
| ember-lokijs | https://github.com/null-null-null/ember-lokijs | No |
| ember-json-api | https://github.com/kurko/ember-json-api | No |
| ember-parse-adapter | https://github.com/clintjhill/ember-parse-adapter | No |
| ember-data-fixture-adapter | https://github.com/emberjs/ember-data-fixture-adapter | No |
| ember-socrata | https://github.com/zachgarwood/ember-socrata | No |
| ember-horizon | https://github.com/lifegadget/ember-horizon | No |
| ember-data-sails | https://github.com/huafu/ember-data-sails | No |
| ember-data-contentful | https://github.com/davidpett/ember-data-contentful | No |
| ember-web-api | https://github.com/CrshOverride/ember-web-api | No |
| ember-localstorage-with-where-adapter | https://github.com/bvellacott/ember-localstorage-with-where-adapter | No |
| ember-orchestrate | https://github.com/bigmoves/ember-orchestrate/blob/master/addon/adapter.js | No |
| ember-data-endpoints | https://github.com/endpoints/ember-data-endpoints/ | No |
| ember-couch | https://github.com/ValidUSA/ember-couch | No |
| ember-syncano | https://github.com/Syncano/ember-syncano | No |
| mantel | https://github.com/mileszim/mantel | No |
| ember-contentful-delivery-adapter | https://github.com/BondarenkoAlex/ember-contentful-delivery-adapter | No |
| ember-data-link-traversal | https://github.com/makepanic/ember-data-link-traversal | No |
| ember-wordpress | https://github.com/oskarrough/ember-wordpress/ | No |
| ember-solr | https://github.com/chriseldredge/ember-solr | No |
| ember-cli-activemodel-adapter | https://github.com/johnotander/ember-cli-activemodel-adapter | No |
| bc-ember-data-sails | https://github.com/brickclick/ember-data-sails | No |
| ember-indexeddb-adapter | https://github.com/rmmmp/ember-indexeddb-adapter | No |
| ember-sqlite-adapter | https://github.com/bitzesty/ember-sqlite-adapter | No |
| ember-fhir-adapter | https://github.com/intervention-engine/ember-fhir-adapter | No |
| ember-cli-horizon | https://github.com/jonesetc/ember-cli-horizon | No |
| ember-youtube-data-model | https://github.com/foxnewsnetwork/ember-youtube-data-model | No |
| ember-data-hal-adapter | https://github.com/locks/ember-data-hal-adapter | No |
| ember-data-in-memory-adapter | https://github.com/pgengler/ember-data-in-memory-adapter | No |
| ember-cli-localstorage-adapter | https://github.com/eibrahim/ember-cli-localstorage-adapter | No |
| cordova-contact-adapter | https://github.com/huafu/cordova-contact-adapter | No |
| ember-data-primus | https://github.com/pichfl/ember-data-primus | No |
| ember-parse | https://github.com/getblimp/ember-parse | No |
@stefanpenner What do you think about adding a method to the snapshotRecordArray to access the original record array? Then making the last arg a snapshot and documenting it? We can open a pr to the emberfire repo to help them upgrade to using the snapshot.
@bmac thanks for doing the homework on this one, awesome!
Something like?
snapshot = recordArray._createSnapshot();
snapshot._liveArray = recordArray;
Something like that. _liveArray already exists. Do we want to make it public? https://github.com/emberjs/data/blob/master/addon/-private/system/snapshot-record-array.js#L27
@bmac good point. So under normal situations, I would say no. But this case may want it?
I would prefer to keep it isolated to this one scenario (would hate for it to be accidentally used in other scenarios), so maybe we expose its only for this adapter call?
exposing it only for this adapter call sounds good to me.
@igorT mentioned we may consider making this snapshot implement MutableArray, then there would be no change required to firebase.
Actually the fourth parameter is documented for an adapter, it's in the DS.Adapter#query.
We lost the ability to programmatically detect whether we needed to pass RecordArray and now always do. We will eventually replace the current Adapter paradigm with something else but until we do the RecordArray passing is here to stay :(
Most helpful comment
Actually the fourth parameter is documented for an adapter, it's in the DS.Adapter#query.