fix(ci): 质量检查 - 同步格式、前端断言与存储降级
This commit is contained in:
@@ -29,7 +29,6 @@ export function AppChangelogDialog({ open, onClose }: { open: boolean; onClose:
|
||||
footer={null}
|
||||
centered
|
||||
onCancel={onClose}
|
||||
styles={{ body: { padding: 0 } }}
|
||||
modalRender={(node) => (
|
||||
<motion.div initial={reducedMotion ? false : { opacity: 0, y: 14, scale: 0.975 }} animate={{ opacity: 1, y: 0, scale: 1 }} transition={{ duration: aceternityMotion.duration.panel, ease: aceternityMotion.easing.enter }}>
|
||||
{node}
|
||||
|
||||
@@ -8,19 +8,26 @@ localforage.config({
|
||||
storeName: "app_state",
|
||||
});
|
||||
|
||||
// localforage 需要 localStorage / indexedDB 等浏览器存储驱动;测试进程等环境可能只有 window 而无存储 API,
|
||||
// 此时直接跳过读写,避免 localforage 内部回退并输出 "No available storage method found"。
|
||||
function browserStorageAvailable(): boolean {
|
||||
if (typeof window === "undefined") return false;
|
||||
return typeof window.localStorage !== "undefined" || typeof window.indexedDB !== "undefined";
|
||||
}
|
||||
|
||||
export function localForageStorageForScope(scope?: string): StateStorage {
|
||||
const keyFor = (name: string) => scopedStorageKey(name, scope);
|
||||
return {
|
||||
getItem: async (name) => {
|
||||
if (typeof window === "undefined") return null;
|
||||
if (!browserStorageAvailable()) return null;
|
||||
return (await localforage.getItem<string>(keyFor(name))) || null;
|
||||
},
|
||||
setItem: async (name, value) => {
|
||||
if (typeof window === "undefined") return;
|
||||
if (!browserStorageAvailable()) return;
|
||||
await localforage.setItem(keyFor(name), value);
|
||||
},
|
||||
removeItem: async (name) => {
|
||||
if (typeof window === "undefined") return;
|
||||
if (!browserStorageAvailable()) return;
|
||||
await localforage.removeItem(keyFor(name));
|
||||
},
|
||||
};
|
||||
|
||||
@@ -420,7 +420,8 @@ const canvasStorage: PersistStorage<CanvasStore> = {
|
||||
if (canvasSaveTimers.get(scope) === timer) canvasSaveTimers.delete(scope);
|
||||
void writeQueuedCanvasPersist(scope, token).catch((error) => {
|
||||
// 自动保存无法把异常返回给原始状态更新调用方,但失败队列仍会保留给下一次写入或显式 flush 重试。
|
||||
console.error("画布本地持久化失败,已保留待写队列", { scope, error });
|
||||
// 自动保存失败有队列兜底,属可降级场景;在无本地存储的环境(如测试进程)不应升级为错误级日志。
|
||||
console.warn("画布本地持久化失败,已保留待写队列", { scope, error });
|
||||
});
|
||||
}, 400);
|
||||
canvasSaveTimers.set(scope, timer);
|
||||
|
||||
@@ -693,6 +693,11 @@
|
||||
background: var(--user-surface);
|
||||
}
|
||||
|
||||
/* 内容区自带内边距(.app-changelog-scroll),弹窗 body 不再叠加,保持产品壳层拥有间距。 */
|
||||
.app-changelog-modal .ant-modal-body {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.app-changelog-heading {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
Reference in New Issue
Block a user