From 972b03f8428937632c65389f960cb0d5836b9e71 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 5 Jul 2022 19:16:21 +0900 Subject: [PATCH] perf: allow get for notes/reactions --- packages/backend/src/server/api/endpoints/notes/reactions.ts | 3 +++ packages/client/src/components/reactions-viewer.reaction.vue | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/backend/src/server/api/endpoints/notes/reactions.ts b/packages/backend/src/server/api/endpoints/notes/reactions.ts index fbb065329..15a62d394 100644 --- a/packages/backend/src/server/api/endpoints/notes/reactions.ts +++ b/packages/backend/src/server/api/endpoints/notes/reactions.ts @@ -9,6 +9,9 @@ export const meta = { requireCredential: false, + allowGet: true, + cacheSec: 60, + res: { type: 'array', optional: false, nullable: false, diff --git a/packages/client/src/components/reactions-viewer.reaction.vue b/packages/client/src/components/reactions-viewer.reaction.vue index ee40615f1..c29bd4640 100644 --- a/packages/client/src/components/reactions-viewer.reaction.vue +++ b/packages/client/src/components/reactions-viewer.reaction.vue @@ -70,10 +70,11 @@ onMounted(() => { }); useTooltip(buttonRef, async (showing) => { - const reactions = await os.api('notes/reactions', { + const reactions = await os.apiGet('notes/reactions', { noteId: props.note.id, type: props.reaction, limit: 11, + _cacheKey_: props.count, }); const users = reactions.map(x => x.user);