mirror of
https://github.com/elk-zone/elk.git
synced 2024-11-19 23:40:07 +00:00
fix: refresh status after edit (#2032)
This commit is contained in:
parent
c7b77216c1
commit
ccf115ca4c
3 changed files with 13 additions and 3 deletions
|
@ -7,6 +7,10 @@ const props = defineProps<{
|
|||
command?: boolean
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
(event: 'afterEdit'): void
|
||||
}>()
|
||||
|
||||
const { details, command } = $(props)
|
||||
|
||||
const {
|
||||
|
@ -101,10 +105,11 @@ function reply() {
|
|||
}
|
||||
|
||||
async function editStatus() {
|
||||
openPublishDialog(`edit-${status.id}`, {
|
||||
await openPublishDialog(`edit-${status.id}`, {
|
||||
...await getDraftFromStatus(status),
|
||||
editingStatus: status,
|
||||
}, true)
|
||||
emit('afterEdit')
|
||||
}
|
||||
|
||||
function showFavoritedAndBoostedBy() {
|
||||
|
|
|
@ -10,6 +10,10 @@ const props = withDefaults(defineProps<{
|
|||
actions: true,
|
||||
})
|
||||
|
||||
defineEmits<{
|
||||
(event: 'refetchStatus'): void
|
||||
}>()
|
||||
|
||||
const status = $computed(() => {
|
||||
if (props.status.reblog && props.status.reblog)
|
||||
return props.status.reblog
|
||||
|
@ -27,7 +31,7 @@ useHydratedHead({
|
|||
|
||||
<template>
|
||||
<div :id="`status-${status.id}`" flex flex-col gap-2 pt2 pb1 ps-3 pe-4 relative :lang="status.language ?? undefined" aria-roledescription="status-details">
|
||||
<StatusActionsMore :status="status" absolute inset-ie-2 top-2 />
|
||||
<StatusActionsMore :status="status" absolute inset-ie-2 top-2 @after-edit="$emit('refetchStatus')" />
|
||||
<NuxtLink :to="getAccountRoute(status.account)" rounded-full hover:bg-active transition-100 pe5 me-a>
|
||||
<AccountHoverWrapper :account="status.account">
|
||||
<AccountInfo :account="status.account" />
|
||||
|
|
|
@ -16,7 +16,7 @@ const main = ref<ComponentPublicInstance | null>(null)
|
|||
|
||||
const { data: status, pending, refresh: refreshStatus } = useAsyncData(
|
||||
`status:${id}`,
|
||||
() => fetchStatus(id),
|
||||
() => fetchStatus(id, true),
|
||||
{ watch: [isHydrated], immediate: isHydrated.value, default: () => shallowRef() },
|
||||
)
|
||||
const { client } = $(useMasto())
|
||||
|
@ -83,6 +83,7 @@ onReactivated(() => {
|
|||
:newer="context?.ancestors.at(-1)"
|
||||
command
|
||||
style="scroll-margin-top: 60px"
|
||||
@refetch-status="refreshStatus()"
|
||||
/>
|
||||
<PublishWidget
|
||||
v-if="currentUser"
|
||||
|
|
Loading…
Reference in a new issue