Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: not refresh status after edit #2032

Merged
merged 1 commit into from
Apr 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion components/status/StatusActionsMore.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ const props = defineProps<{
command?: boolean
}>()

const emit = defineEmits<{
(event: 'afterEdit'): void
}>()

const { details, command } = $(props)

const {
Expand Down Expand Up @@ -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() {
Expand Down
6 changes: 5 additions & 1 deletion components/status/StatusDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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" />
Expand Down
3 changes: 2 additions & 1 deletion pages/[[server]]/@[account]/[status].vue
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -83,6 +83,7 @@ onReactivated(() => {
:newer="context?.ancestors.at(-1)"
command
style="scroll-margin-top: 60px"
@refetch-status="refreshStatus()"
/>
<PublishWidget
v-if="currentUser"
Expand Down