summaryrefslogtreecommitdiff
path: root/packages/frontend/src/pages/note.vue
diff options
context:
space:
mode:
authorsyuilo <4439005+syuilo@users.noreply.github.com>2024-11-21 07:58:34 +0900
committerGitHub <noreply@github.com>2024-11-21 07:58:34 +0900
commitf0c3a4cc0b47b392dd155ebabea0d5587df2753d (patch)
tree116098b3f4f5013d3656f5c33573d1fb030db3a0 /packages/frontend/src/pages/note.vue
parentfeat: 絵文字のポップアップメニューに編集を追加 (#15004) (diff)
downloadmisskey-f0c3a4cc0b47b392dd155ebabea0d5587df2753d.tar.gz
misskey-f0c3a4cc0b47b392dd155ebabea0d5587df2753d.tar.bz2
misskey-f0c3a4cc0b47b392dd155ebabea0d5587df2753d.zip
perf(frontend): reduce api requests for non-logged-in enviroment (#15001)
* wip * Update CHANGELOG.md * wip
Diffstat (limited to 'packages/frontend/src/pages/note.vue')
-rw-r--r--packages/frontend/src/pages/note.vue11
1 files changed, 10 insertions, 1 deletions
diff --git a/packages/frontend/src/pages/note.vue b/packages/frontend/src/pages/note.vue
index 454ee3c6bc..3e1d04bd6d 100644
--- a/packages/frontend/src/pages/note.vue
+++ b/packages/frontend/src/pages/note.vue
@@ -62,13 +62,16 @@ import { dateString } from '@/filters/date.js';
import MkClipPreview from '@/components/MkClipPreview.vue';
import { defaultStore } from '@/store.js';
import { pleaseLogin } from '@/scripts/please-login.js';
+import { getServerContext } from '@/server-context.js';
+
+const CTX_NOTE = getServerContext('note');
const props = defineProps<{
noteId: string;
initialTab?: string;
}>();
-const note = ref<null | Misskey.entities.Note>();
+const note = ref<null | Misskey.entities.Note>(CTX_NOTE);
const clips = ref<Misskey.entities.Clip[]>();
const showPrev = ref<'user' | 'channel' | false>(false);
const showNext = ref<'user' | 'channel' | false>(false);
@@ -116,6 +119,12 @@ function fetchNote() {
showPrev.value = false;
showNext.value = false;
note.value = null;
+
+ if (CTX_NOTE && CTX_NOTE.id === props.noteId) {
+ note.value = CTX_NOTE;
+ return;
+ }
+
misskeyApi('notes/show', {
noteId: props.noteId,
}).then(res => {