src/utils/query.js
function docChangeEvent(change, originalMeta = {}) {
  const meta = { ...cloneDeep(originalMeta), path: change.doc.ref.path };
  if (originalMeta.subcollections && !originalMeta.storeAs) {
    meta.subcollections[0] = { ...meta.subcollections[0], doc: change.doc.id };
  } else {
    meta.doc = change.doc.id;
  }
  return {
    type: changeTypeToEventType[change.type] || actionTypes.DOCUMENT_MODIFIED,
    meta,
    payload: {
      data: change.doc.data(),
      ordered: { oldIndex: change.oldIndex, newIndex: change.newIndex },
    },
  };
}
function docChangeEvent(change, originalMeta = {}) {
  const meta = { ...cloneDeep(originalMeta), path: change.doc.ref.path };
  if (originalMeta.subcollections && !originalMeta.storeAs) {
    meta.subcollections[0] = { ...meta.subcollections[0], doc: change.doc.id };
  } else {
    meta.doc = change.doc.id;
  }
  return {
    type: changeTypeToEventType[change.type] || actionTypes.DOCUMENT_MODIFIED,
    meta,
    payload: {
      data: change.doc.data(),
      ordered: { oldIndex: change.oldIndex, newIndex: change.newIndex },
    },
  };
}
function docChangeEvent ( change , originalMeta = { } ) { const meta = { ... cloneDeep ( originalMeta ) , path : change . doc . ref . path } ; if ( originalMeta . subcollections && ! originalMeta . storeAs ) { meta . subcollections [ 0 ] = { ... meta . subcollections [ 0 ] , doc : change . doc . id } ; } else { meta . doc = change . doc . id ; } return { type : changeTypeToEventType [ change . type ] || actionTypes . DOCUMENT_MODIFIED , meta , payload : { data : change . doc . data ( ) , ordered : { oldIndex : change . oldIndex , newIndex : change . newIndex } , } , } ; }
Action creator for document change event. Used to create action objects
to be passed to dispatch.
@param  {Object} change - Document change object from Firebase callback
@param  {Object} [originalMeta={}] - Original meta data of action
@return {Object}                   [description]
Action creator for document change event . Used to create action objects to be passed to dispatch .