fix crash on abandoned collection claim
This commit is contained in:
parent
e20baa0683
commit
40fc75320d
3 changed files with 28 additions and 18 deletions
21
dist/bundle.es.js
vendored
21
dist/bundle.es.js
vendored
|
@ -1040,8 +1040,8 @@ var shared_preferences = /*#__PURE__*/Object.freeze({
|
|||
CLIENT_SYNC_KEYS: CLIENT_SYNC_KEYS
|
||||
});
|
||||
|
||||
const COLLECTION_ID = 'colid';
|
||||
const COLLECTION_INDEX = 'colindex';
|
||||
const COLLECTION_ID = 'lid';
|
||||
const COLLECTION_INDEX = 'linx';
|
||||
|
||||
const COL_TYPE_PLAYLIST = 'playlist';
|
||||
const COL_TYPE_CHANNELS = 'channelList';
|
||||
|
@ -4662,16 +4662,21 @@ const doFetchItemsInCollections = (resolveItemsOptions, resolveStartedCallback)
|
|||
const claimId = claim.claim_id;
|
||||
const itemOrder = claim.value.claims;
|
||||
|
||||
const sortResults = function (results, claimList) {
|
||||
const newResults = [];
|
||||
const sortResults = function (items, claimList) {
|
||||
const newItems = [];
|
||||
claimList.forEach(function (id) {
|
||||
const index = results.findIndex(function (i) {
|
||||
const index = items.findIndex(function (i) {
|
||||
return i.claim_id === id;
|
||||
});
|
||||
const item = results.splice(index, 1);
|
||||
if (item) newResults.push(item[0]);
|
||||
if (index >= 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) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
export const COLLECTION_ID = 'colid';
|
||||
export const COLLECTION_INDEX = 'colindex';
|
||||
export const COLLECTION_ID = 'lid';
|
||||
export const COLLECTION_INDEX = 'linx';
|
||||
|
||||
export const COL_TYPE_PLAYLIST = 'playlist';
|
||||
export const COL_TYPE_CHANNELS = 'channelList';
|
||||
|
|
|
@ -124,14 +124,19 @@ export const doFetchItemsInCollections = (
|
|||
const claimId = claim.claim_id;
|
||||
const itemOrder = claim.value.claims;
|
||||
|
||||
const sortResults = (results: Array<Claim>, claimList) => {
|
||||
const newResults: Array<Claim> = [];
|
||||
const sortResults = (items: Array<Claim>, claimList) => {
|
||||
const newItems: Array<Claim> = [];
|
||||
claimList.forEach(id => {
|
||||
const index = results.findIndex(i => i.claim_id === id);
|
||||
const item = results.splice(index, 1);
|
||||
if (item) newResults.push(item[0]);
|
||||
const index = items.findIndex(i => i.claim_id === id);
|
||||
if (index >= 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 = (
|
||||
|
|
Loading…
Reference in a new issue