diff --git a/frontend/src/components/Contributions/ContributionList.vue b/frontend/src/components/Contributions/ContributionList.vue index 889bc8fd2..e7fbd750d 100644 --- a/frontend/src/components/Contributions/ContributionList.vue +++ b/frontend/src/components/Contributions/ContributionList.vue @@ -67,6 +67,7 @@ const props = defineProps({ }) const emit = defineEmits([ + 'close-all-open-collapse', 'update-list-contributions', 'update-contribution-form', 'delete-contribution', diff --git a/frontend/src/components/Contributions/ContributionListItem.spec.js b/frontend/src/components/Contributions/ContributionListItem.spec.js index eb5fb1247..300076060 100644 --- a/frontend/src/components/Contributions/ContributionListItem.spec.js +++ b/frontend/src/components/Contributions/ContributionListItem.spec.js @@ -14,6 +14,7 @@ vi.mock('@vue/apollo-composable', () => ({ onResult: vi.fn(), onError: vi.fn(), load: vi.fn(), + refetch: vi.fn(), })), useMutation: vi.fn(() => ({ mutate: vi.fn(), diff --git a/frontend/src/components/Contributions/ContributionListItem.vue b/frontend/src/components/Contributions/ContributionListItem.vue index a08af2e4c..2b0e2b0a1 100644 --- a/frontend/src/components/Contributions/ContributionListItem.vue +++ b/frontend/src/components/Contributions/ContributionListItem.vue @@ -246,7 +246,7 @@ function deleteContribution(item) { } } -const { onResult, onError, load } = useLazyQuery(listContributionMessages, { +const { onResult, onError, load, refetch } = useLazyQuery(listContributionMessages, { contributionId: props.contributionId, }) @@ -254,9 +254,15 @@ function getListContributionMessages(closeCollapse = true) { if (closeCollapse) { emit('close-all-open-collapse') } - load(listContributionMessages, { + const variables = { contributionId: props.contributionId, - }) + } + // load works only once and return false on second call + if (!load(listContributionMessages, variables)) { + // update list data every time getListContributionMessages is called + // because it could be added new messages + refetch(variables) + } } onResult((resultValue) => { diff --git a/frontend/src/pages/Community.vue b/frontend/src/pages/Community.vue index d9772b7b7..7fe55bd99 100644 --- a/frontend/src/pages/Community.vue +++ b/frontend/src/pages/Community.vue @@ -29,7 +29,7 @@ :show-pagination="true" :page-size="pageSize" @close-all-open-collapse="closeAllOpenCollapse" - @update-list-contributions="handleUpdateListAllContributions" + @update-list-contributions="handleUpdateListContributions" @update-contribution-form="handleUpdateContributionForm" @delete-contribution="handleDeleteContribution" @update-status="updateStatus"