This commit is contained in:
tamaina 2023-07-30 11:37:07 +00:00
parent 58bdd7c129
commit f6f6384acf
2 changed files with 21 additions and 16 deletions

View File

@ -33,12 +33,14 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts" setup>
import { shallowRef } from 'vue';
import { computed, shallowRef } from 'vue';
import MkNote from '@/components/MkNote.vue';
import MkDateSeparatedList from '@/components/MkDateSeparatedList.vue';
import MkDateSeparatedList, { MisskeyEntity } from '@/components/MkDateSeparatedList.vue';
import MkPagination, { Paging } from '@/components/MkPagination.vue';
import { i18n } from '@/i18n';
import { infoImageUrl } from '@/instance';
import { noteManager } from '@/scripts/entity-manager';
import { Note } from 'misskey-js/built/entities';
const props = defineProps<{
pagination: Paging;
@ -47,6 +49,23 @@ const props = defineProps<{
const pagingComponent = shallowRef<InstanceType<typeof MkPagination>>();
const transform = (notes: Note[]): MisskeyEntity[] => {
return notes.map(note => {
noteManager.set(note);
return {
id: note.id,
createdAt: note.createdAt,
};
});
};
const pagination = computed(() => {
return {
transform,
...props.pagination,
};
});
defineExpose({
pagingComponent,
});

View File

@ -26,9 +26,6 @@ import { $i } from '@/account';
import { defaultStore } from '@/store';
import { i18n } from '@/i18n';
import { instance } from '@/instance';
import { noteManager } from '@/scripts/entity-manager';
import { Note } from 'misskey-js/built/entities';
import { MisskeyEntity } from '@/types/date-separated-list';
const props = defineProps<{
src: string;
@ -65,16 +62,6 @@ const prepend = note => {
}
};
const transform = (notes: Note[]): MisskeyEntity[] => {
return notes.map(note => {
noteManager.set(note);
return {
id: note.id,
createdAt: note.createdAt,
};
});
};
let endpoint;
let query;
let connection;
@ -178,7 +165,6 @@ const pagination = {
endpoint: endpoint,
limit: 10,
params: query,
transform: transform,
};
onUnmounted(() => {