fix
This commit is contained in:
parent
23e5927bcd
commit
6010ffd4cb
|
@ -282,7 +282,7 @@ export class Paginator<
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.order.value === 'oldest') {
|
if (this.order.value === 'oldest') {
|
||||||
this.unshiftItems(apiRes.toReversed(), true);
|
this.unshiftItems(apiRes.toReversed(), false);
|
||||||
} else {
|
} else {
|
||||||
this.pushItems(apiRes);
|
this.pushItems(apiRes);
|
||||||
}
|
}
|
||||||
|
@ -341,7 +341,7 @@ export class Paginator<
|
||||||
if (this.order.value === 'oldest') {
|
if (this.order.value === 'oldest') {
|
||||||
this.pushItems(apiRes);
|
this.pushItems(apiRes);
|
||||||
} else {
|
} else {
|
||||||
this.unshiftItems(apiRes.toReversed(), true);
|
this.unshiftItems(apiRes.toReversed(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -362,10 +362,10 @@ export class Paginator<
|
||||||
if (this.useShallowRef && trigger) triggerRef(this.items);
|
if (this.useShallowRef && trigger) triggerRef(this.items);
|
||||||
}
|
}
|
||||||
|
|
||||||
public unshiftItems(newItems: T[], noTrim = false): void {
|
public unshiftItems(newItems: T[], trim = true): void {
|
||||||
if (newItems.length === 0) return; // これやらないと余計なre-renderが走る
|
if (newItems.length === 0) return; // これやらないと余計なre-renderが走る
|
||||||
this.items.value.unshift(...newItems.filter(x => !this.items.value.some(y => y.id === x.id))); // ストリーミングやポーリングのタイミングによっては重複することがあるため
|
this.items.value.unshift(...newItems.filter(x => !this.items.value.some(y => y.id === x.id))); // ストリーミングやポーリングのタイミングによっては重複することがあるため
|
||||||
if (!noTrim) this.trim(true);
|
if (trim) this.trim(true);
|
||||||
if (this.useShallowRef) triggerRef(this.items);
|
if (this.useShallowRef) triggerRef(this.items);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue