@xhub-reels/sdk 0.2.6 → 0.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +13 -6
- package/dist/index.js +13 -6
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -593,16 +593,23 @@ var FeedManager = class {
|
|
|
593
593
|
applyItems(incoming, _nextCursor, append) {
|
|
594
594
|
const { itemsById, displayOrder } = this.store.getState();
|
|
595
595
|
const nextById = new Map(itemsById);
|
|
596
|
-
const existingIds = new Set(displayOrder);
|
|
597
|
-
const newIds = [];
|
|
598
596
|
for (const item of incoming) {
|
|
599
|
-
if (!existingIds.has(item.id)) {
|
|
600
|
-
newIds.push(item.id);
|
|
601
|
-
}
|
|
602
597
|
nextById.set(item.id, item);
|
|
603
598
|
this.accessOrder.set(item.id, Date.now());
|
|
604
599
|
}
|
|
605
|
-
|
|
600
|
+
let nextOrder;
|
|
601
|
+
if (append) {
|
|
602
|
+
const existingIds = new Set(displayOrder);
|
|
603
|
+
const newIds = [];
|
|
604
|
+
for (const item of incoming) {
|
|
605
|
+
if (!existingIds.has(item.id)) {
|
|
606
|
+
newIds.push(item.id);
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
nextOrder = [...displayOrder, ...newIds];
|
|
610
|
+
} else {
|
|
611
|
+
nextOrder = incoming.map((item) => item.id);
|
|
612
|
+
}
|
|
606
613
|
if (nextById.size > this.config.maxCacheSize) {
|
|
607
614
|
this.evictLRU(nextById, nextOrder);
|
|
608
615
|
}
|
package/dist/index.js
CHANGED
|
@@ -587,16 +587,23 @@ var FeedManager = class {
|
|
|
587
587
|
applyItems(incoming, _nextCursor, append) {
|
|
588
588
|
const { itemsById, displayOrder } = this.store.getState();
|
|
589
589
|
const nextById = new Map(itemsById);
|
|
590
|
-
const existingIds = new Set(displayOrder);
|
|
591
|
-
const newIds = [];
|
|
592
590
|
for (const item of incoming) {
|
|
593
|
-
if (!existingIds.has(item.id)) {
|
|
594
|
-
newIds.push(item.id);
|
|
595
|
-
}
|
|
596
591
|
nextById.set(item.id, item);
|
|
597
592
|
this.accessOrder.set(item.id, Date.now());
|
|
598
593
|
}
|
|
599
|
-
|
|
594
|
+
let nextOrder;
|
|
595
|
+
if (append) {
|
|
596
|
+
const existingIds = new Set(displayOrder);
|
|
597
|
+
const newIds = [];
|
|
598
|
+
for (const item of incoming) {
|
|
599
|
+
if (!existingIds.has(item.id)) {
|
|
600
|
+
newIds.push(item.id);
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
nextOrder = [...displayOrder, ...newIds];
|
|
604
|
+
} else {
|
|
605
|
+
nextOrder = incoming.map((item) => item.id);
|
|
606
|
+
}
|
|
600
607
|
if (nextById.size > this.config.maxCacheSize) {
|
|
601
608
|
this.evictLRU(nextById, nextOrder);
|
|
602
609
|
}
|