From ddbe213f594dcdd2bd67392c485a19c9ad2c168e Mon Sep 17 00:00:00 2001 From: naskya Date: Tue, 17 Oct 2023 06:32:36 +0900 Subject: [PATCH] feat: show all reacted users initially in reactions tab --- packages/client/src/components/MkReactedUsers.vue | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/client/src/components/MkReactedUsers.vue b/packages/client/src/components/MkReactedUsers.vue index 6e0b0fc8c..e685f9072 100644 --- a/packages/client/src/components/MkReactedUsers.vue +++ b/packages/client/src/components/MkReactedUsers.vue @@ -47,11 +47,11 @@ const props = defineProps<{ }>(); const note = ref(); -const tab = ref(); +const tab = ref(null); const reactions = ref(); const users = ref(); -watch(tab, async () => { +async function updateUsers(): void { const res = await os.api("notes/reactions", { noteId: props.noteId, type: tab.value, @@ -59,15 +59,17 @@ watch(tab, async () => { }); users.value = res.map((x) => x.user); -}); +} + +watch(tab, updateUsers); onMounted(() => { os.api("notes/show", { noteId: props.noteId, - }).then((res) => { + }).then(async (res) => { reactions.value = Object.keys(res.reactions); - tab.value = reactions.value[0]; note.value = res; + await updateUsers(); }); });