refactor: 提示与确认框改用 App 上下文实例
CI / Static checks (push) Has been cancelled
CI / Production build (push) Has been cancelled
CI / API integration (push) Has been cancelled
CI / Taro builds (acheng-campus-food) (push) Has been cancelled
CI / Taro builds (atelier-solopreneur) (push) Has been cancelled
CI / Taro builds (linjing-editorial) (push) Has been cancelled
CI / Browser regression (push) Has been cancelled
CI / Static checks (push) Has been cancelled
CI / Production build (push) Has been cancelled
CI / API integration (push) Has been cancelled
CI / Taro builds (acheng-campus-food) (push) Has been cancelled
CI / Taro builds (atelier-solopreneur) (push) Has been cancelled
CI / Taro builds (linjing-editorial) (push) Has been cancelled
CI / Browser regression (push) Has been cancelled
This commit is contained in:
1 parent
3a0099e674
commit
06619a191f
22 files changed
+167
-27
No files matched your search
@@ -33,7 +33,7 @@ import {
|
||||
} from "./routes.js";
|
||||
import { LoadingStack } from "../components/LoadingStack.js";
|
||||
import { AdminMenu } from "../components/AdminMenu.js";
|
||||
import { adminMessage as message } from "../components/AdminMessage.js";
|
||||
import { App } from "antd";
|
||||
import { AdminButton } from "../components/AdminButton.js";
|
||||
import { AdminSelect } from "../components/AdminSelect.js";
|
||||
import { AdminLayout } from "../components/AdminLayout.js";
|
||||
@@ -51,6 +51,7 @@ export function Dashboard({
|
||||
role: string;
|
||||
platformTemplateRole: "none" | "template_admin";
|
||||
}) {
|
||||
const { message } = App.useApp();
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
const brand = useQuery({
|
||||
|
||||
@@ -3,13 +3,14 @@ import type { AdminSession } from "@personal-brand/api-client";
|
||||
import { ChangePassword, Login } from "../features/auth/AuthPages.js";
|
||||
import { Dashboard } from "./Dashboard.js";
|
||||
import { AdminRouter } from "./AdminRouter.js";
|
||||
import { adminMessage as message } from "../components/AdminMessage.js";
|
||||
import { App } from "antd";
|
||||
import { createApiClient } from "../lib/api.js";
|
||||
import { LoadingStack } from "../components/LoadingStack.js";
|
||||
|
||||
type SessionState = Omit<AdminSession, "authenticated">;
|
||||
|
||||
export function Root() {
|
||||
const { message } = App.useApp();
|
||||
const [session, setSession] = useState<SessionState | null>(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
export { message as adminMessage } from "antd";
|
||||
@@ -1,5 +1,5 @@
|
||||
import { CloudUploadOutlined, DeleteOutlined, PictureOutlined } from "@ant-design/icons";
|
||||
import { Alert, Button, Image, Popconfirm, Spin, Upload, message } from "antd";
|
||||
import { Alert, App, Button, Image, Popconfirm, Spin, Upload } from "antd";
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import { apiBaseUrl, authenticatedFetch, createApiClient } from "../lib/api.js";
|
||||
|
||||
@@ -12,6 +12,7 @@ interface ImageUrlFieldProps {
|
||||
}
|
||||
|
||||
export function ImageUrlField({ id, value, onChange, placeholder, scope }: ImageUrlFieldProps) {
|
||||
const { message } = App.useApp();
|
||||
const imageUrl = typeof value === "string" ? value.trim() : "";
|
||||
const [uploading, setUploading] = useState(false);
|
||||
const [storageStatus, setStorageStatus] = useState<
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Form, message } from "antd";
|
||||
import { App, Form } from "antd";
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import type { TemplateAdminSection } from "@personal-brand/api-client";
|
||||
@@ -59,6 +59,7 @@ export function useRecordContentEditorState({
|
||||
onDraft?: ((values: PresentationValues) => void) | undefined;
|
||||
onSaved?: (() => void) | undefined;
|
||||
}) {
|
||||
const { message } = App.useApp();
|
||||
const [form] = Form.useForm<PresentationValues>();
|
||||
const queryClient = useQueryClient();
|
||||
const [draftValues, setDraftValues] = useState<PresentationValues>(() =>
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import { useState } from "react";
|
||||
import { App } from "antd";
|
||||
import { createApiClient } from "../../lib/api.js";
|
||||
import { BrandMark } from "../../components/BrandMark.js";
|
||||
import { adminMessage as message } from "../../components/AdminMessage.js";
|
||||
import { AdminButton } from "../../components/AdminButton.js";
|
||||
import { AdminCard } from "../../components/AdminCard.js";
|
||||
import { AdminForm, AdminInput } from "../../components/AdminForm.js";
|
||||
import type { AdminLoginSession } from "@personal-brand/api-client";
|
||||
|
||||
export function Login({ onLogin }: { onLogin: (session: AdminLoginSession) => void }) {
|
||||
const { message } = App.useApp();
|
||||
const [form] = AdminForm.useForm();
|
||||
const [loading, setLoading] = useState(false);
|
||||
async function submit(values: { username: string; password: string }) {
|
||||
@@ -52,6 +53,7 @@ export function Login({ onLogin }: { onLogin: (session: AdminLoginSession) => vo
|
||||
}
|
||||
|
||||
export function ChangePassword({ onComplete }: { onComplete: () => void }) {
|
||||
const { message } = App.useApp();
|
||||
const [form] = AdminForm.useForm<{
|
||||
currentPassword: string;
|
||||
newPassword: string;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Alert, Button, Col, Form, Input, Row, Segmented, message } from "antd";
|
||||
import { Alert, App, Button, Col, Form, Input, Row, Segmented } from "antd";
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { useState } from "react";
|
||||
import { Link, useLocation } from "react-router-dom";
|
||||
@@ -14,6 +14,7 @@ import "./BrandPage.css";
|
||||
import { useEditorDraft } from "./use-editor-draft.js";
|
||||
|
||||
export function BrandPage() {
|
||||
const { message } = App.useApp();
|
||||
const location = useLocation();
|
||||
const initialSelection = location.state as PreviewSelection | undefined;
|
||||
const [panel, setPanel] = useState("pages");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Alert, Button, Form, Input, Select, Space, Switch, message } from "antd";
|
||||
import { Alert, App, Button, Form, Input, Select, Space, Switch } from "antd";
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { useEffect } from "react";
|
||||
import type { RuntimeWorkspace } from "@personal-brand/api-client";
|
||||
@@ -18,6 +18,7 @@ export function InquiryPreviewEditor({
|
||||
onDraft: (fields: RuntimeInquiryForm["fields"]) => void;
|
||||
onSaved?: () => void;
|
||||
}) {
|
||||
const { message } = App.useApp();
|
||||
const [form] = Form.useForm<Record<string, unknown>>();
|
||||
const cache = useQueryClient();
|
||||
const query = useQuery({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Form, message } from "antd";
|
||||
import { App, Form } from "antd";
|
||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||
import type { QueryClient } from "@tanstack/react-query";
|
||||
import { useCallback, useEffect, useMemo, useState } from "react";
|
||||
@@ -108,6 +108,7 @@ export function useBrandSaveMutation({
|
||||
queryClient,
|
||||
onSaved,
|
||||
}: BrandSaveMutationOptions) {
|
||||
const { message } = App.useApp();
|
||||
return useMutation({
|
||||
mutationFn: (values: PresentationValues) => {
|
||||
const nextConfig = applyPresentationValues(config, sections, values);
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { useEffect } from "react";
|
||||
import { Modal } from "antd";
|
||||
import { App } from "antd";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
|
||||
export function useEditorDraft(dirty: boolean) {
|
||||
const { modal } = App.useApp();
|
||||
const navigate = useNavigate();
|
||||
useEffect(() => {
|
||||
if (!dirty) return;
|
||||
@@ -22,7 +23,7 @@ export function useEditorDraft(dirty: boolean) {
|
||||
return;
|
||||
event.preventDefault();
|
||||
event.stopImmediatePropagation();
|
||||
Modal.confirm({
|
||||
modal.confirm({
|
||||
title: "有尚未保存的修改",
|
||||
content: "离开工作台会丢失未保存内容。请先保存,或确认放弃修改。",
|
||||
okText: "放弃修改并继续",
|
||||
@@ -40,7 +41,7 @@ export function useEditorDraft(dirty: boolean) {
|
||||
}, [dirty, navigate]);
|
||||
return (action: () => void) => {
|
||||
if (!dirty) return action();
|
||||
Modal.confirm({
|
||||
modal.confirm({
|
||||
title: "有尚未保存的修改",
|
||||
content: "切换后当前内容可能丢失。请先保存,或确认放弃修改。",
|
||||
okText: "放弃修改并继续",
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { Alert, Button, Card, Col, Row, Space } from "antd";
|
||||
import { Alert, App, Button, Card, Col, Row, Space } from "antd";
|
||||
import { PlusOutlined } from "@ant-design/icons";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { createApiClient } from "../../lib/api.js";
|
||||
import { adminMessage as message } from "../../components/AdminMessage.js";
|
||||
import { AdminPageHeader } from "../../components/AdminPageHeader.js";
|
||||
import { EmptyState } from "../../components/EmptyState.js";
|
||||
import { QueryState } from "../../components/QueryState.js";
|
||||
@@ -12,6 +11,7 @@ import { StatusTag } from "../../components/StatusTag.js";
|
||||
const client = createApiClient();
|
||||
|
||||
export function BrandsPage({ canCreate }: { canCreate: boolean }) {
|
||||
const { message } = App.useApp();
|
||||
const navigate = useNavigate();
|
||||
const brands = useQuery({
|
||||
queryKey: ["admin-brand-memberships"],
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { message } from "antd";
|
||||
import { App } from "antd";
|
||||
import { createApiClient } from "../../../lib/api.js";
|
||||
import { readAdminCapability } from "../types.js";
|
||||
import type { CapabilityValues } from "../types.js";
|
||||
@@ -17,6 +17,7 @@ export function useCapabilityQuery() {
|
||||
}
|
||||
|
||||
export function useCapabilityMutation() {
|
||||
const { message } = App.useApp();
|
||||
const queryClient = useQueryClient();
|
||||
return useMutation({
|
||||
mutationFn: ({ key, ...values }: { key: string } & CapabilityValues) =>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Badge, Button, Descriptions, Drawer, Select, Space, Table, message, Input } from "antd";
|
||||
import { App, Badge, Button, Descriptions, Drawer, Select, Space, Table, Input } from "antd";
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import type { AdminBooking, InquirySubmission } from "@personal-brand/api-client";
|
||||
import { createApiClient } from "../../lib/api.js";
|
||||
@@ -51,6 +51,7 @@ const statusTones: Record<string, StatusTone> = {
|
||||
};
|
||||
|
||||
export function InquiriesPage() {
|
||||
const { message } = App.useApp();
|
||||
const client = createApiClient();
|
||||
const queryClient = useQueryClient();
|
||||
const [status, setStatus] = useState<string>();
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { Alert, Button, Card, Collapse, Descriptions, Empty, List, Modal, Space, Tag } from "antd";
|
||||
import { Alert, App, Button, Card, Collapse, Descriptions, Empty, List, Space, Tag } from "antd";
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { createApiClient } from "../../lib/api.js";
|
||||
import { adminMessage as message } from "../../components/AdminMessage.js";
|
||||
import { AdminPageHeader } from "../../components/AdminPageHeader.js";
|
||||
import { AdminSection } from "../../components/AdminSection.js";
|
||||
import { MutationError, QueryState } from "../../components/QueryState.js";
|
||||
@@ -11,6 +10,7 @@ import { StatusTag } from "../../components/StatusTag.js";
|
||||
const client = createApiClient();
|
||||
|
||||
export function PageSchemePage() {
|
||||
const { message, modal } = App.useApp();
|
||||
const queryClient = useQueryClient();
|
||||
const [selectedVersionId, setSelectedVersionId] = useState<string>();
|
||||
const [samplePreview, setSamplePreview] = useState<Awaited<
|
||||
@@ -135,7 +135,7 @@ export function PageSchemePage() {
|
||||
const target = compatibleSchemes.find(
|
||||
(scheme) => scheme.templatePackageVersionId === templatePackageVersionId,
|
||||
);
|
||||
Modal.confirm({
|
||||
modal.confirm({
|
||||
title: "切换页面方案版本",
|
||||
content: target
|
||||
? `将当前品牌切换到「${target.name}」版本 ${target.version}。现有品牌内容会保留。`
|
||||
@@ -147,7 +147,7 @@ export function PageSchemePage() {
|
||||
};
|
||||
const confirmUpgrade = () => {
|
||||
const preview = upgradePreview.data;
|
||||
Modal.confirm({
|
||||
modal.confirm({
|
||||
title: "升级页面方案",
|
||||
content:
|
||||
preview && preview.conflicts.length
|
||||
@@ -159,7 +159,7 @@ export function PageSchemePage() {
|
||||
});
|
||||
};
|
||||
const confirmRollback = () => {
|
||||
Modal.confirm({
|
||||
modal.confirm({
|
||||
title: "恢复上一版配置基线",
|
||||
content: "此操作只恢复上一版页面方案配置,不会删除品牌内容、业务提供项或咨询记录。",
|
||||
okText: "确认恢复",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
import { message } from "antd";
|
||||
import { App } from "antd";
|
||||
import { createApiClient } from "../../lib/api.js";
|
||||
|
||||
const client = createApiClient();
|
||||
@@ -17,6 +17,7 @@ export function usePublicationMutations({
|
||||
onNoteClear,
|
||||
onRollbackClose,
|
||||
}: MutationOptions) {
|
||||
const { message } = App.useApp();
|
||||
const queryClient = useQueryClient();
|
||||
const publish = useMutation({
|
||||
mutationFn: (note: string) => client.publishAdminRelease(note || undefined),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import type { Offering } from "@personal-brand/api-client";
|
||||
import { message } from "antd";
|
||||
import { App } from "antd";
|
||||
import { useMemo } from "react";
|
||||
import { createApiClient } from "../../lib/api.js";
|
||||
import {
|
||||
@@ -46,6 +46,7 @@ export function useOfferingMutations(options: {
|
||||
templateFields: ReturnType<typeof offeringTemplateFields>;
|
||||
onSuccess: () => void;
|
||||
}) {
|
||||
const { message } = App.useApp();
|
||||
const client = createApiClient();
|
||||
const queryClient = useQueryClient();
|
||||
const invalidateAfterSave = () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Alert, Button, Card, Form, Input, Modal, Select, Space, Table, message } from "antd";
|
||||
import { Alert, App, Button, Card, Form, Input, Modal, Select, Space, Table } from "antd";
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import type { AdminBrandMember } from "@personal-brand/api-client";
|
||||
import { useState } from "react";
|
||||
@@ -16,6 +16,7 @@ const roleLabels: Record<string, string> = {
|
||||
};
|
||||
|
||||
export function MembersPage() {
|
||||
const { message } = App.useApp();
|
||||
const client = createApiClient();
|
||||
const queryClient = useQueryClient();
|
||||
const [addOpen, setAddOpen] = useState(false);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useRef, useState } from "react";
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { Alert, Button, List, Modal, Table, Tag, Typography, message } from "antd";
|
||||
import { Alert, App, Button, List, Modal, Table, Tag, Typography } from "antd";
|
||||
import { EyeOutlined, ReloadOutlined, UploadOutlined } from "@ant-design/icons";
|
||||
import type { TemplatePackageVersion } from "@personal-brand/api-client";
|
||||
import { createApiClient } from "../../lib/api.js";
|
||||
@@ -31,6 +31,7 @@ function formatBytes(value: unknown): string {
|
||||
}
|
||||
|
||||
export function TemplateManagementPage() {
|
||||
const { message } = App.useApp();
|
||||
const inputRef = useRef<HTMLInputElement>(null);
|
||||
const [page, setPage] = useState(1);
|
||||
const [pageSize, setPageSize] = useState(20);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
import { message } from "antd";
|
||||
import { App } from "antd";
|
||||
import type { TrustContent, TrustContentInput } from "@personal-brand/api-client";
|
||||
import { createApiClient } from "../../../lib/api.js";
|
||||
|
||||
@@ -10,6 +10,7 @@ export function useTrustContentMutations({
|
||||
editing: TrustContent | null;
|
||||
closeEditor: () => void;
|
||||
}) {
|
||||
const { message } = App.useApp();
|
||||
const client = createApiClient();
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { message } from "antd";
|
||||
import { App } from "antd";
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
import type { FormInstance } from "antd";
|
||||
import type { BrandFieldDefinition, InquiryForm } from "@personal-brand/api-client";
|
||||
@@ -19,6 +19,7 @@ export function useFieldMutations({
|
||||
queryClient,
|
||||
onClose,
|
||||
}: FieldMutationOptions) {
|
||||
const { message } = App.useApp();
|
||||
const createField = useMutation({
|
||||
mutationFn: (values: Omit<BrandFieldDefinition, "id" | "source">) =>
|
||||
client.createAdminField(values),
|
||||
@@ -49,6 +50,7 @@ export function useInquiryFormMutations({
|
||||
};
|
||||
onClose: () => void;
|
||||
}) {
|
||||
const { message } = App.useApp();
|
||||
const createForm = useMutation({
|
||||
mutationFn: (values: {
|
||||
name: string;
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { readdir, readFile, access } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { test } from "node:test";
|
||||
|
||||
const sourceRoot = path.resolve(import.meta.dirname, "../src");
|
||||
|
||||
async function listSourceFiles(directory) {
|
||||
const entries = await readdir(directory, { withFileTypes: true });
|
||||
const files = await Promise.all(
|
||||
entries.map(async (entry) => {
|
||||
const absolute = path.join(directory, entry.name);
|
||||
if (entry.isDirectory()) return listSourceFiles(absolute);
|
||||
return /\.(?:ts|tsx)$/.test(entry.name) ? [absolute] : [];
|
||||
}),
|
||||
);
|
||||
return files.flat();
|
||||
}
|
||||
|
||||
function readTag(source, start) {
|
||||
let index = start;
|
||||
let quote = null;
|
||||
while (index < source.length) {
|
||||
const char = source[index];
|
||||
if (quote) {
|
||||
if (char === quote) quote = null;
|
||||
} else if (char === '"' || char === "'" || char === "`") {
|
||||
quote = char;
|
||||
} else if (char === ">") {
|
||||
return source.slice(start, index + 1);
|
||||
}
|
||||
index += 1;
|
||||
}
|
||||
return source.slice(start);
|
||||
}
|
||||
|
||||
function tagsNamed(source, name) {
|
||||
const tags = [];
|
||||
for (const match of source.matchAll(new RegExp("<" + name + "\\b", "g"))) {
|
||||
tags.push(readTag(source, match.index));
|
||||
}
|
||||
return tags;
|
||||
}
|
||||
|
||||
test("Admin 源码不使用 Ant Design 6 已弃用的静态提示 API", async () => {
|
||||
const files = await listSourceFiles(sourceRoot);
|
||||
const violations = [];
|
||||
for (const file of files) {
|
||||
const source = await readFile(file, "utf8");
|
||||
const relative = path.relative(sourceRoot, file);
|
||||
if (/import\s*\{[^}]*\bmessage\b[^}]*\}\s*from\s*"antd"/.test(source)) {
|
||||
violations.push(`${relative}: 仍从 antd 导入静态 message`);
|
||||
}
|
||||
if (/\bModal\.confirm\s*\(/.test(source)) {
|
||||
violations.push(`${relative}: 仍调用静态 Modal.confirm`);
|
||||
}
|
||||
for (const tag of tagsNamed(source, "Alert")) {
|
||||
if (/(?<![\w.])message\s*=/.test(tag)) {
|
||||
violations.push(`${relative}: Alert 仍使用 message 属性`);
|
||||
}
|
||||
}
|
||||
for (const tag of tagsNamed(source, "Space")) {
|
||||
if (/(?<![\w.])direction\s*=/.test(tag)) {
|
||||
violations.push(`${relative}: Space 仍使用 direction 属性`);
|
||||
}
|
||||
}
|
||||
}
|
||||
assert.deepEqual(violations, []);
|
||||
});
|
||||
|
||||
test("Admin 不再保留静态 message 转出口", async () => {
|
||||
const legacyBridge = path.resolve(sourceRoot, "components/AdminMessage.ts");
|
||||
await assert.rejects(access(legacyBridge));
|
||||
});
|
||||
@@ -0,0 +1,48 @@
|
||||
# 0034 Ant Design 6 弃用项收口
|
||||
|
||||
- 状态:已采纳
|
||||
- 日期:2026-10-21
|
||||
|
||||
## Context
|
||||
|
||||
Admin 升级到 Ant Design 6.6 后,开发态控制台持续出现弃用提示:
|
||||
|
||||
- `Alert.message` 已改名为 `title`。
|
||||
- `Space.direction` 已改名为 `orientation`。
|
||||
- 静态 `message.*` 与 `Modal.confirm` 无法读取 `ConfigProvider` 的动态主题上下文。
|
||||
- `List` 标记为 deprecated,官方建议 6.6+ 改用 `Listy`。
|
||||
|
||||
这些提示不影响功能,但会淹没真正有价值的新警告,也让后续升级到 Ant Design 7 时缺少明确清单。
|
||||
|
||||
## Decision
|
||||
|
||||
1. `Alert` 统一使用 `title`;正文仍用 `description`。
|
||||
2. `Space` 统一使用 `orientation`。
|
||||
3. 所有提示与确认框改为 `App.useApp()` 取得的实例:
|
||||
- 组件与自定义 hook 在函数体首部声明 `const { message } = App.useApp();`。
|
||||
- 确认框改为 `const { modal } = App.useApp();` 后调用 `modal.confirm`。
|
||||
- 删除 `components/AdminMessage.ts` 这一静态转出口,避免再次绕过上下文。
|
||||
4. 暂不迁移 `List` → `Listy`:
|
||||
- `Listy` 是虚拟滚动列表,API 与 `List` 不兼容(需要 `itemHeight`、`renderItem` 等)。
|
||||
- 当前 `List` 仅用于审计日志、失败计数和模板模块清单等小数据量场景,最大条数受分页或模板规模限制。
|
||||
- 用 `Listy` 替换属于渲染行为变更,需要单独的可视回归,不应混在机械迁移里。
|
||||
|
||||
## Alternatives
|
||||
|
||||
- 保留静态 `message` / `Modal.confirm`:提示不继承动态主题,且 Ant Design 7 会移除,拒绝。
|
||||
- 用自建单例桥接 `App` 上下文:等于重新发明静态 API,并引入第二种提示模式,拒绝。
|
||||
- 本轮直接把 `List` 换成 `Listy`:改动面大、收益低,且缺少分页与固定高度语义,推迟。
|
||||
|
||||
## Consequences
|
||||
|
||||
- Admin 源码不再出现 `Alert.message`、`Space.direction`、静态 `message` 和 `Modal.confirm`。
|
||||
- 提示与确认框跟随 `ConfigProvider` 主题与国际化。
|
||||
- `List` 的弃用提示仍会出现在开发态控制台,作为已知技术债登记。
|
||||
- 触发迁移 `List` → `Listy` 的条件:Ant Design 7 升级,或某个 `List` 数据源增长到需要虚拟滚动的规模。
|
||||
|
||||
## Migration plan
|
||||
|
||||
1. 机械迁移 `Alert` 与 `Space` 属性,跑 `typecheck`、`lint`、`test`、`build`。
|
||||
2. 把静态提示 API 改为 `App.useApp()`,删除静态转出口。
|
||||
3. 用 Admin 浏览器回归验证创建品牌、页面方案和会话过期提示流程。
|
||||
4. 升级 Ant Design 7 前重新评估 `List` 的使用点。
|
||||
Reference in new issue
Block a user