Merge upstream
This commit is contained in:
commit
3e0bcd2b5b
9 changed files with 173 additions and 159 deletions
|
@ -72,9 +72,9 @@
|
|||
"typescript": "5.8.2",
|
||||
"uuid": "11.1.0",
|
||||
"v-code-diff": "1.13.1",
|
||||
"vite": "6.2.3",
|
||||
"vite": "6.2.4",
|
||||
"vue": "3.5.13",
|
||||
"vue-gtag": "3.1.1",
|
||||
"vue-gtag": "3.2.0",
|
||||
"vuedraggable": "next",
|
||||
"webgl-audiovisualizer": "github:tar-bin/webgl-audiovisualizer"
|
||||
},
|
||||
|
@ -114,7 +114,7 @@
|
|||
"@types/ws": "8.18.0",
|
||||
"@typescript-eslint/eslint-plugin": "7.10.0",
|
||||
"@typescript-eslint/parser": "7.10.0",
|
||||
"@vitest/coverage-v8": "3.0.9",
|
||||
"@vitest/coverage-v8": "3.1.1",
|
||||
"@vue/runtime-core": "3.5.13",
|
||||
"acorn": "8.14.1",
|
||||
"cross-env": "7.0.3",
|
||||
|
@ -136,7 +136,7 @@
|
|||
"storybook": "8.6.11",
|
||||
"storybook-addon-misskey-theme": "github:misskey-dev/storybook-addon-misskey-theme",
|
||||
"vite-plugin-turbosnap": "1.0.3",
|
||||
"vitest": "3.0.9",
|
||||
"vitest": "3.1.1",
|
||||
"vitest-fetch-mock": "0.3.0",
|
||||
"vue-component-type-helpers": "2.2.8",
|
||||
"vue-eslint-parser": "9.4.3",
|
||||
|
|
|
@ -71,26 +71,33 @@ const tlComponent = shallowRef<InstanceType<typeof MkNotes>>();
|
|||
let tlNotesCount = 0;
|
||||
const notVisibleNoteData = new Array<object>();
|
||||
|
||||
async function fulfillNoteData(data) {
|
||||
// チェックするプロパティはなんでも良い
|
||||
// minimizeが有効でid以外が存在しない場合は取得する
|
||||
if (!data.visibility) {
|
||||
const res = await window.fetch(`/notes/${data.id}.json`, {
|
||||
method: 'GET',
|
||||
credentials: 'omit',
|
||||
headers: {
|
||||
'Authorization': 'anonymous',
|
||||
'X-Client-Transaction-Id': generateClientTransactionId('misskey'),
|
||||
},
|
||||
});
|
||||
if (!res.ok) return null;
|
||||
return deepMerge(data, await res.json());
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
async function prepend(data) {
|
||||
if (tlComponent.value == null) return;
|
||||
|
||||
let note = data;
|
||||
|
||||
if (!document.hidden) {
|
||||
// チェックするプロパティはなんでも良い
|
||||
// minimizeが有効でid以外が存在しない場合は取得する
|
||||
if (!data.visibility) {
|
||||
const res = await window.fetch(`/notes/${data.id}.json`, {
|
||||
method: 'GET',
|
||||
credentials: 'omit',
|
||||
headers: {
|
||||
'Authorization': 'anonymous',
|
||||
'X-Client-Transaction-Id': generateClientTransactionId('misskey'),
|
||||
},
|
||||
});
|
||||
if (!res.ok) return;
|
||||
note = deepMerge(data, await res.json());
|
||||
}
|
||||
note = await fulfillNoteData(data);
|
||||
if (note == null) return;
|
||||
|
||||
tlNotesCount++;
|
||||
|
||||
|
@ -119,16 +126,20 @@ async function loadUnloadedNotes() {
|
|||
if (tlComponent.value == null) return;
|
||||
if (notVisibleNoteData.length === 0) return;
|
||||
|
||||
if (notVisibleNoteData.length >= 10) {
|
||||
tlComponent.value.pagingComponent?.deleteItem();
|
||||
tlComponent.value.pagingComponent?.stopFetch();
|
||||
}
|
||||
tlComponent.value.pagingComponent?.stopFetch();
|
||||
try {
|
||||
const items = [...notVisibleNoteData];
|
||||
notVisibleNoteData.length = 0;
|
||||
|
||||
while (notVisibleNoteData.length > 0) {
|
||||
await prepend(notVisibleNoteData.shift());
|
||||
}
|
||||
const notes = await Promise.allSettled(items.map(fulfillNoteData));
|
||||
if (items.length >= 10) tlComponent.value.pagingComponent?.deleteItem();
|
||||
|
||||
tlComponent.value.pagingComponent?.startFetch();
|
||||
for (const note of notes.filter(i => i.status === 'fulfilled' && i.value != null)) {
|
||||
await prepend((note as PromiseFulfilledResult<object>).value);
|
||||
}
|
||||
} finally {
|
||||
tlComponent.value.pagingComponent?.startFetch();
|
||||
}
|
||||
}
|
||||
|
||||
let connection: Misskey.ChannelConnection | null = null;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue