Skip to content

Let's use AI to Earn!

fix(发布): 修复发布完成后图片未被清除的bug

gaoSir809b12b77e34
diff --git a/src/components/AvatarPlat/index.tsx b/src/components/AvatarPlat/index.tsx
index ce271963..67b368c0 100644
--- a/src/components/AvatarPlat/index.tsx
+++ b/src/components/AvatarPlat/index.tsx
@@ -17,7 +17,7 @@ export interface IAvatarPlatProps {
}
const getAvatar = (url: string) => {
- if (url.includes("https://")) {
+ if (url?.includes("https://")) {
return url;
} else {
return `${OSS_DOMAIN}/` + url;
diff --git a/src/components/PublishDialog/compoents/PlatParamsSetting/hooks/usePlatParamsCoomon.tsx b/src/components/PublishDialog/compoents/PlatParamsSetting/hooks/usePlatParamsCoomon.tsx
index d7bf170f..7941e81f 100644
--- a/src/components/PublishDialog/compoents/PlatParamsSetting/hooks/usePlatParamsCoomon.tsx
+++ b/src/components/PublishDialog/compoents/PlatParamsSetting/hooks/usePlatParamsCoomon.tsx
@@ -1,6 +1,6 @@
import { usePublishDialog } from "@/components/PublishDialog/usePublishDialog";
import { useShallow } from "zustand/react/shallow";
-import { useCallback, useMemo } from "react";
+import { useCallback, useEffect, useMemo } from "react";
import {
IChangeParams,
IPubParmasTextareaProps,
diff --git a/src/components/PublishDialog/compoents/PubParmasTextarea/index.tsx b/src/components/PublishDialog/compoents/PubParmasTextarea/index.tsx
index 62c5a0a5..ba8a4fb2 100644
--- a/src/components/PublishDialog/compoents/PubParmasTextarea/index.tsx
+++ b/src/components/PublishDialog/compoents/PubParmasTextarea/index.tsx
@@ -103,11 +103,7 @@ const PubParmasTextarea = memo(
if (onChange) onChange(values);
}, [imageFileList, videoFile, value]);
useEffect(() => {
- if (imageFileListValue.length === 0 && imageFileList.length === 0)
- return;
- if (isEqual(imageFileListValue, imageFileList)) {
- setImageFileList(imageFileListValue);
- }
+ setImageFileList(imageFileListValue ?? []);
}, [imageFileListValue]);
useEffect(() => {
setValue(desValue || "");