Skip to content

Commit 81b0b33

Browse files
authored
fix(frontend): prevent flash of empty seed opinion page during conversation creation (#408)
When clicking "Publier" to create a conversation with seed opinions, the page briefly flashed the empty seed opinion creation form before navigating to the final conversation page. This occurred because the loading state was being cleared in a finally block that executed immediately after router.replace() was called, but before the navigation and component unmount completed. Changes: - Remove try/finally wrapper (unnecessary since createNewPost never throws) - Keep loading state active during successful navigation - Only clear loading state on error case when user stays on the page - Component now unmounts with loading state still active, preventing flash This ensures a smooth transition from the review page to the conversation page without showing intermediate UI states.
1 parent 403e4e9 commit 81b0b33

1 file changed

Lines changed: 40 additions & 41 deletions

File tree

  • services/agora/src/pages/conversation/new/review

services/agora/src/pages/conversation/new/review/index.vue

Lines changed: 40 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -312,50 +312,49 @@ async function onSubmit() {
312312
313313
isSubmitButtonLoading.value = true;
314314
315-
try {
316-
const response = await createNewPost({
317-
postTitle: conversationDraft.value.title,
318-
postBody:
319-
conversationDraft.value.content == ""
320-
? undefined
321-
: conversationDraft.value.content,
322-
pollingOptionList: conversationDraft.value.poll.enabled
323-
? conversationDraft.value.poll.options
324-
: undefined,
325-
postAsOrganizationName: conversationDraft.value.postAs.postAsOrganization
326-
? conversationDraft.value.postAs.organizationName
327-
: "",
328-
targetIsoConvertDateString: conversationDraft.value
329-
.privateConversationSettings.hasScheduledConversion
330-
? conversationDraft.value.privateConversationSettings.conversionDate.toISOString()
331-
: undefined,
332-
isIndexed: !conversationDraft.value.isPrivate,
333-
isLoginRequired: !conversationDraft.value.isPrivate
334-
? false
335-
: conversationDraft.value.privateConversationSettings.requiresLogin,
336-
seedOpinionList: conversationDraft.value.seedOpinions,
315+
const response = await createNewPost({
316+
postTitle: conversationDraft.value.title,
317+
postBody:
318+
conversationDraft.value.content == ""
319+
? undefined
320+
: conversationDraft.value.content,
321+
pollingOptionList: conversationDraft.value.poll.enabled
322+
? conversationDraft.value.poll.options
323+
: undefined,
324+
postAsOrganizationName: conversationDraft.value.postAs.postAsOrganization
325+
? conversationDraft.value.postAs.organizationName
326+
: "",
327+
targetIsoConvertDateString: conversationDraft.value
328+
.privateConversationSettings.hasScheduledConversion
329+
? conversationDraft.value.privateConversationSettings.conversionDate.toISOString()
330+
: undefined,
331+
isIndexed: !conversationDraft.value.isPrivate,
332+
isLoginRequired: !conversationDraft.value.isPrivate
333+
? false
334+
: conversationDraft.value.privateConversationSettings.requiresLogin,
335+
seedOpinionList: conversationDraft.value.seedOpinions,
336+
});
337+
338+
if (response.status == "success") {
339+
conversationDraft.value = createEmptyDraft();
340+
341+
await loadPostData();
342+
343+
// Set navigation context to indicate user came from conversation creation
344+
navigationStore.setConversationCreationContext(true);
345+
346+
await router.replace({
347+
name: "/conversation/[postSlugId]",
348+
params: { postSlugId: response.data.conversationSlugId },
337349
});
338350
339-
if (response.status == "success") {
340-
conversationDraft.value = createEmptyDraft();
341-
342-
await loadPostData();
343-
344-
// Set navigation context to indicate user came from conversation creation
345-
navigationStore.setConversationCreationContext(true);
346-
347-
await router.replace({
348-
name: "/conversation/[postSlugId]",
349-
params: { postSlugId: response.data.conversationSlugId },
350-
});
351-
} else {
352-
handleAxiosErrorStatusCodes({
353-
axiosErrorCode: response.code,
354-
defaultMessage: t("errorCreatingConversation"),
355-
});
356-
}
357-
} finally {
351+
// Don't stop loading - let component unmount with loading state active
352+
} else {
358353
isSubmitButtonLoading.value = false;
354+
handleAxiosErrorStatusCodes({
355+
axiosErrorCode: response.code,
356+
defaultMessage: t("errorCreatingConversation"),
357+
});
359358
}
360359
}
361360
}

0 commit comments

Comments
 (0)