addToData = ({ queryResult, multiResolverName, document, sort, selector }) => {
    const queryData = queryResult[multiResolverName];
    let { results, totalCount } = queryData;
    const idx = positionInSet(results, document);
    let newResults = [...results];
    if (idx !== -1) {
        // doc has already been added, eg after an optimistic response
        // update it
        newResults[idx] = document;
    } else {
        // add to list
        newResults.unshift(document);
        totalCount = totalCount + 1;
    }
    // sort if necessary
    if (sort) {
        newResults = reorderSet(newResults, sort, selector);
    }
    return {
        ...queryResult,
        [multiResolverName]: {
            ...queryData,
            // TODO: check order using mingo
            results: newResults,
            totalCount
        }
    };
}
Add to data
@param {*} queryData 
@param {*} document