Skip to content

Commit

Permalink
fix(preview): draft ready not received event
Browse files Browse the repository at this point in the history
  • Loading branch information
larbish committed Jan 21, 2025
1 parent 9979db5 commit a8ee72e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/runtime/components/ContentPreviewMode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ onMounted(async () => {
if (!data) {
// Request draft sync via Preview API
try {
// Wait for draft:ready and then request sync to get the data back with 'draft:ready'
socket.once('draft:ready', () => {
socket.emit('draft:requestSync')
})
// Request preview sync from Preview API
await $fetch('api/projects/preview/sync', {
baseURL: props.api,
Expand All @@ -111,11 +116,6 @@ onMounted(async () => {
token: props.previewToken,
},
})
// Wait for draft:ready and then request sync to get the data back with 'draft:ready'
socket.once('draft:ready', () => {
socket.emit('draft:requestSync')
})
}
catch (e: any) { // eslint-disable-line @typescript-eslint/no-explicit-any
clearSyncTimeout()
Expand Down

0 comments on commit a8ee72e

Please sign in to comment.