From 8c5204d0c97e21606c330156a2235c464265e25d Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Fri, 16 May 2025 16:55:17 +0530 Subject: [PATCH] feat: use computed for conversation ID --- app/javascript/ui/MessageList.vue | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/app/javascript/ui/MessageList.vue b/app/javascript/ui/MessageList.vue index 7dd9b216c..a1155a211 100644 --- a/app/javascript/ui/MessageList.vue +++ b/app/javascript/ui/MessageList.vue @@ -13,12 +13,9 @@ import { useCamelCase } from '../dashboard/composables/useTransformKeys'; import { useInfiniteScroll, useThrottleFn } from '@vueuse/core'; import { useI18n } from 'vue-i18n'; -const props = defineProps({ - conversationId: { - type: Number, - // eslint-disable-next-line no-underscore-dangle - default: window.__WOOT_CONVERSATION_ID__, - }, +const conversationId = computed(() => { + // eslint-disable-next-line no-underscore-dangle + return window.__WOOT_CONVERSATION_ID__; }); const { t } = useI18n(); @@ -30,7 +27,7 @@ const isFetching = ref(false); const typingUserList = useFunctionGetter( 'conversationTypingStatus/getUserList', - props.conversationId + conversationId.value ); const isAnyoneTyping = computed(() => { @@ -45,7 +42,7 @@ const typingUserNames = computed(() => { }); const conversation = computed(() => { - return store.getters.getConversationById(props.conversationId); + return store.getters.getConversationById(conversationId.value); }); const allMessages = computed(() => { @@ -72,7 +69,7 @@ const fetchMore = () => { onMounted(() => { store.dispatch('inboxes/get'); - store.dispatch('getConversation', props.conversationId); + store.dispatch('getConversation', conversationId.value); }); watch(conversation, () => {