Collections #383
21
dist/bundle.es.js
vendored
|
@ -1040,8 +1040,8 @@ var shared_preferences = /*#__PURE__*/Object.freeze({
|
||||||
CLIENT_SYNC_KEYS: CLIENT_SYNC_KEYS
|
CLIENT_SYNC_KEYS: CLIENT_SYNC_KEYS
|
||||||
});
|
});
|
||||||
|
|
||||||
const COLLECTION_ID = 'colid';
|
const COLLECTION_ID = 'lid';
|
||||||
const COLLECTION_INDEX = 'colindex';
|
const COLLECTION_INDEX = 'linx';
|
||||||
|
|
||||||
const COL_TYPE_PLAYLIST = 'playlist';
|
const COL_TYPE_PLAYLIST = 'playlist';
|
||||||
const COL_TYPE_CHANNELS = 'channelList';
|
const COL_TYPE_CHANNELS = 'channelList';
|
||||||
|
@ -4662,16 +4662,21 @@ const doFetchItemsInCollections = (resolveItemsOptions, resolveStartedCallback)
|
||||||
const claimId = claim.claim_id;
|
const claimId = claim.claim_id;
|
||||||
const itemOrder = claim.value.claims;
|
const itemOrder = claim.value.claims;
|
||||||
|
|
||||||
const sortResults = function (results, claimList) {
|
const sortResults = function (items, claimList) {
|
||||||
const newResults = [];
|
const newItems = [];
|
||||||
claimList.forEach(function (id) {
|
claimList.forEach(function (id) {
|
||||||
const index = results.findIndex(function (i) {
|
const index = items.findIndex(function (i) {
|
||||||
return i.claim_id === id;
|
return i.claim_id === id;
|
||||||
});
|
});
|
||||||
const item = results.splice(index, 1);
|
if (index >= 0) {
|
||||||
if (item) newResults.push(item[0]);
|
newItems.push(items[index]);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return newResults;
|
/*
|
||||||
|
This will return newItems[] of length less than total_items below
|
||||||
|
if one or more of the claims has been abandoned. That's ok for now.
|
||||||
|
*/
|
||||||
|
return newItems;
|
||||||
};
|
};
|
||||||
|
|
||||||
const mergeBatches = function (arrayOfResults, claimList) {
|
const mergeBatches = function (arrayOfResults, claimList) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
export const COLLECTION_ID = 'colid';
|
export const COLLECTION_ID = 'lid';
|
||||||
export const COLLECTION_INDEX = 'colindex';
|
export const COLLECTION_INDEX = 'linx';
|
||||||
|
|
||||||
export const COL_TYPE_PLAYLIST = 'playlist';
|
export const COL_TYPE_PLAYLIST = 'playlist';
|
||||||
export const COL_TYPE_CHANNELS = 'channelList';
|
export const COL_TYPE_CHANNELS = 'channelList';
|
||||||
|
|
|
@ -124,14 +124,19 @@ export const doFetchItemsInCollections = (
|
||||||
Array/< { claimId: string, items: ?Array } > Array/< { claimId: string, items: ?Array<GenericClaim> } >
|
|||||||
const claimId = claim.claim_id;
|
const claimId = claim.claim_id;
|
||||||
const itemOrder = claim.value.claims;
|
const itemOrder = claim.value.claims;
|
||||||
|
|
||||||
const sortResults = (results: Array<Claim>, claimList) => {
|
const sortResults = (items: Array<Claim>, claimList) => {
|
||||||
Array/< { claimId: string, items: ?Array } > Array/< { claimId: string, items: ?Array<GenericClaim> } >
Array/< { claimId: string, items: ?Array } > Array/< { claimId: string, items: ?Array<GenericClaim> } >
|
|||||||
const newResults: Array<Claim> = [];
|
const newItems: Array<Claim> = [];
|
||||||
Array/< { claimId: string, items: ?Array } > Array/< { claimId: string, items: ?Array<GenericClaim> } >
Array/< { claimId: string, items: ?Array } > Array/< { claimId: string, items: ?Array<GenericClaim> } >
|
|||||||
claimList.forEach(id => {
|
claimList.forEach(id => {
|
||||||
const index = results.findIndex(i => i.claim_id === id);
|
const index = items.findIndex(i => i.claim_id === id);
|
||||||
Array/< { claimId: string, items: ?Array } > Array/< { claimId: string, items: ?Array<GenericClaim> } >
Array/< { claimId: string, items: ?Array } > Array/< { claimId: string, items: ?Array<GenericClaim> } >
|
|||||||
const item = results.splice(index, 1);
|
if (index >= 0) {
|
||||||
Array/< { claimId: string, items: ?Array } > Array/< { claimId: string, items: ?Array<GenericClaim> } >
Array/< { claimId: string, items: ?Array } > Array/< { claimId: string, items: ?Array<GenericClaim> } >
|
|||||||
if (item) newResults.push(item[0]);
|
newItems.push(items[index]);
|
||||||
Array/< { claimId: string, items: ?Array } > Array/< { claimId: string, items: ?Array<GenericClaim> } >
Array/< { claimId: string, items: ?Array } > Array/< { claimId: string, items: ?Array<GenericClaim> } >
|
|||||||
|
}
|
||||||
Array/< { claimId: string, items: ?Array } > Array/< { claimId: string, items: ?Array<GenericClaim> } >
|
|||||||
});
|
});
|
||||||
return newResults;
|
/*
|
||||||
Array/< { claimId: string, items: ?Array } > Array/< { claimId: string, items: ?Array<GenericClaim> } >
Array/< { claimId: string, items: ?Array } > Array/< { claimId: string, items: ?Array<GenericClaim> } >
|
|||||||
|
This will return newItems[] of length less than total_items below
|
||||||
Array/< { claimId: string, items: ?Array } > Array/< { claimId: string, items: ?Array<GenericClaim> } >
|
|||||||
|
if one or more of the claims has been abandoned. That's ok for now.
|
||||||
Array/< { claimId: string, items: ?Array } > Array/< { claimId: string, items: ?Array<GenericClaim> } >
|
|||||||
|
*/
|
||||||
Array/< { claimId: string, items: ?Array } > Array/< { claimId: string, items: ?Array<GenericClaim> } >
|
|||||||
|
return newItems;
|
||||||
Array/< { claimId: string, items: ?Array } > Array/< { claimId: string, items: ?Array<GenericClaim> } >
|
|||||||
};
|
};
|
||||||
|
|
||||||
const mergeBatches = (
|
const mergeBatches = (
|
||||||
|
|
||||||
Array/< { claimId: string, items: ?Array } > Array/< { claimId: string, items: ?Array<GenericClaim> } >
Array/< { claimId: string, items: ?Array } > Array/< { claimId: string, items: ?Array<GenericClaim> } >
|
Array/< { claimId: string, items: ?Array } >