Wait for AppView after dismissing composer
This commit is contained in:
@@ -305,17 +305,6 @@ export const ComposePost = observer(function ComposePost({
|
|||||||
langs: toPostLanguages(langPrefs.postLanguage),
|
langs: toPostLanguages(langPrefs.postLanguage),
|
||||||
})
|
})
|
||||||
).uri
|
).uri
|
||||||
try {
|
|
||||||
await whenAppViewReady(agent, postUri, res => {
|
|
||||||
const thread = res.data.thread
|
|
||||||
return AppBskyFeedDefs.isThreadViewPost(thread)
|
|
||||||
})
|
|
||||||
} catch (waitErr: any) {
|
|
||||||
logger.error(waitErr, {
|
|
||||||
message: `Waiting for app view failed`,
|
|
||||||
})
|
|
||||||
// Keep going because the post *was* published.
|
|
||||||
}
|
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
logger.error(e, {
|
logger.error(e, {
|
||||||
message: `Composer: create post failed`,
|
message: `Composer: create post failed`,
|
||||||
@@ -354,17 +343,30 @@ export const ComposePost = observer(function ComposePost({
|
|||||||
})
|
})
|
||||||
if (replyTo && replyTo.uri) track('Post:Reply')
|
if (replyTo && replyTo.uri) track('Post:Reply')
|
||||||
}
|
}
|
||||||
if (postUri && !replyTo) {
|
|
||||||
emitPostCreated()
|
|
||||||
}
|
|
||||||
setLangPrefs.savePostLanguageToHistory()
|
setLangPrefs.savePostLanguageToHistory()
|
||||||
onPost?.()
|
|
||||||
onClose()
|
onClose()
|
||||||
Toast.show(
|
Toast.show(
|
||||||
replyTo
|
replyTo
|
||||||
? _(msg`Your reply has been published`)
|
? _(msg`Your reply has been published`)
|
||||||
: _(msg`Your post has been published`),
|
: _(msg`Your post has been published`),
|
||||||
)
|
)
|
||||||
|
try {
|
||||||
|
if (postUri) {
|
||||||
|
await whenAppViewReady(agent, postUri, res => {
|
||||||
|
const thread = res.data.thread
|
||||||
|
return AppBskyFeedDefs.isThreadViewPost(thread)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} catch (waitErr: any) {
|
||||||
|
logger.error(waitErr, {
|
||||||
|
message: `Waiting for app view failed`,
|
||||||
|
})
|
||||||
|
} finally {
|
||||||
|
if (postUri && !replyTo) {
|
||||||
|
emitPostCreated()
|
||||||
|
}
|
||||||
|
onPost?.()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const canPost = useMemo(
|
const canPost = useMemo(
|
||||||
|
|||||||
Reference in New Issue
Block a user