refactor: improve notification handling and avoid backend loop with empty messages

This commit is contained in:
Tunglies
2025-11-07 00:54:16 +08:00
parent 333440535b
commit 19b3899a1b
4 changed files with 23 additions and 20 deletions
+4 -1
View File
@@ -11,7 +11,10 @@ export const handleNoticeMessage = (
) => {
const handlers: Record<string, () => void> = {
"import_sub_url::ok": () => {
navigate("/profile", { state: { current: msg } });
// 空 msg 传入,我们不希望导致 后端-前端-后端 死循环,这里只做提醒。
// 未来细分事件通知时,可以考虑传入订阅 ID 或其他标识符
// navigate("/profile", { state: { current: msg } });
navigate("/profile");
showNotice("success", t("Import Subscription Successful"));
},
"import_sub_url::error": () => {
+4 -4
View File
@@ -13,15 +13,15 @@ import {
sortableKeyboardCoordinates,
} from "@dnd-kit/sortable";
import {
CheckBoxOutlineBlankRounded,
CheckBoxRounded,
ClearRounded,
ContentPasteRounded,
DeleteRounded,
IndeterminateCheckBoxRounded,
LocalFireDepartmentRounded,
RefreshRounded,
TextSnippetOutlined,
CheckBoxOutlineBlankRounded,
CheckBoxRounded,
IndeterminateCheckBoxRounded,
DeleteRounded,
} from "@mui/icons-material";
import { LoadingButton } from "@mui/lab";
import { Box, Button, Divider, Grid, IconButton, Stack } from "@mui/material";