Skip to content

Let's use AI to Earn!

fix: Fix the bug on the release page (#456)

Gao7a7f53c41112
diff --git a/project/web/src/app/[lng]/accounts/accountCore.tsx b/project/web/src/app/[lng]/accounts/accountCore.tsx
index 6a1435b5..5ed6390d 100644
--- a/project/web/src/app/[lng]/accounts/accountCore.tsx
+++ b/project/web/src/app/[lng]/accounts/accountCore.tsx
@@ -19,6 +19,7 @@ import type { IPublishDialogRef } from '@/components/PublishDialog'
import { useAccountStore } from '@/store/account'
import { useUserStore } from '@/store/user'
import { confirm } from '@/lib/confirm'
+import { useCalendarTiming } from './components/CalendarTiming/useCalendarTiming'
interface AccountPageCoreProps {
searchParams?: {
@@ -856,6 +857,7 @@ export default function AccountPageCore({
setPublishDialogOpen(false)
setAiGeneratedData(null)
setDefaultAccountId(undefined)
+ useCalendarTiming.getState().getPubRecord()
}}
/>
)}
diff --git a/project/web/src/components/PublishDialog/index.tsx b/project/web/src/components/PublishDialog/index.tsx
index 48d35966..3e352fc8 100644
--- a/project/web/src/components/PublishDialog/index.tsx
+++ b/project/web/src/components/PublishDialog/index.tsx
@@ -101,13 +101,13 @@ export interface IPublishDialogProps {
// 发布成功事件
onPubSuccess?: () => void;
// 默认选中的账户Id
- defaultAccountId?: string
+ defaultAccountId?: string;
// 是否抑制自动发布(用于从任务页面打开,先让用户确认后再发布)
- suppressAutoPublish?: boolean
+ suppressAutoPublish?: boolean;
// 关联的任务ID(如果是从任务流程打开)
- taskIdForPublish?: string
+ taskIdForPublish?: string;
// 发布确认回调(发布完成时触发,并携带 taskIdForPublish)
- onPublishConfirmed?: (taskId?: string) => void
+ onPublishConfirmed?: (taskId?: string) => void;
}
// 发布作品弹框
@@ -730,41 +730,32 @@ const PublishDialog = memo(
});
}
- // 如果抑制自动发布(来自任务流程),不要自动调用平台 API,但仍需通知外部父组件
- if (suppressAutoPublish) {
- setCreateLoading(false)
-
- // 关闭发布弹框
- try {
- onClose()
- }
- catch (e) {
- // ignore
- }
-
- // 通知外部发布已完成(携带任务 id,如果父组件需要)
- if (onPublishConfirmed) {
- try {
- onPublishConfirmed(taskIdForPublish)
- }
- catch (e) {
- console.error("onPublishConfirmed callback failed", e)
+ // 如果抑制自动发布(来自任务流程),不要自动调用平台 API,但仍需通知外部父组件
+ if (suppressAutoPublish) {
+ // 通知外部发布已完成(携带任务 id,如果父组件需要)
+ if (onPublishConfirmed) {
+ try {
+ onPublishConfirmed(taskIdForPublish);
+ } catch (e) {
+ console.error("onPublishConfirmed callback failed", e);
+ }
}
+ } else {
+ // 给用户提示:发布已提交,可能需要一些时间处理(符合 TikTok API 客户端要求)
+ toast.success(t("messages.publishSubmitted" as any), {
+ key: "publish_submitted",
+ duration: 3,
+ });
}
+ // 关闭发布弹框
+ onClose()
+ setCreateLoading(false)
if (onPubSuccess) {
- try {
- onPubSuccess()
- }
- catch (e) {
- console.error("onPubSuccess callback failed", e)
- }
+ onPubSuccess()
}
-
usePublishDialogStorageStore.getState().clearPubData()
- return
- }
- }, [pubListChoosed, pubTime, isPluginSupportedPlatform, t])
+ }, [pubListChoosed, pubTime, isPluginSupportedPlatform, t]);
// 处理划词操作
const handleTextSelection = useCallback(