refactor(frontend): reduce type errors

This commit is contained in:
syuilo 2024-01-05 12:52:24 +09:00
parent 9e20065496
commit 2177792a3c
4 changed files with 19 additions and 14 deletions

View file

@ -11,13 +11,13 @@ SPDX-License-Identifier: AGPL-3.0-only
:pagination="paginationQuery"
:noGap="!defaultStore.state.showGapBetweenNotesInTimeline"
@queue="emit('queue', $event)"
@status="prComponent.setDisabled($event)"
@status="prComponent?.setDisabled($event)"
/>
</MkPullToRefresh>
</template>
<script lang="ts" setup>
import { computed, watch, onUnmounted, provide, ref } from 'vue';
import { computed, watch, onUnmounted, provide, ref, shallowRef } from 'vue';
import { Connection } from 'misskey-js/built/streaming.js';
import MkNotes from '@/components/MkNotes.vue';
import MkPullToRefresh from '@/components/MkPullToRefresh.vue';
@ -62,12 +62,14 @@ type TimelineQueryType = {
roleId?: string
}
const prComponent = ref<InstanceType<typeof MkPullToRefresh>>();
const tlComponent = ref<InstanceType<typeof MkNotes>>();
const prComponent = shallowRef<InstanceType<typeof MkPullToRefresh>>();
const tlComponent = shallowRef<InstanceType<typeof MkNotes>>();
let tlNotesCount = 0;
const prepend = note => {
function prepend(note) {
if (tlComponent.value == null) return;
tlNotesCount++;
if (instance.notesPerOneAd > 0 && tlNotesCount % instance.notesPerOneAd === 0) {
@ -81,7 +83,7 @@ const prepend = note => {
if (props.sound) {
sound.play($i && (note.userId === $i.id) ? 'noteMy' : 'note');
}
};
}
let connection: Connection;
let connection2: Connection;
@ -246,6 +248,8 @@ onUnmounted(() => {
function reloadTimeline() {
return new Promise<void>((res) => {
if (tlComponent.value == null) return;
tlNotesCount = 0;
tlComponent.value.pagingComponent?.reload().then(() => {