ether-docs/05-ISSUES/known-patterns.json

81 lines
3.1 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"patterns": {
"pat-001": {
"name": "Vite Dev Server与ClashX代理冲突",
"source": "user_feedback",
"confidence": 0.95,
"applications": 5,
"created": "2026-03-21",
"category": "environment",
"pattern": "Vite dev server在ClashX开启时挂起不响应",
"problem": "Node.js HTTP服务器监听成功但curl请求挂起",
"solution": "使用原生Node.js HTTP服务器dev-server.mjs替代Vite dev server或关闭ClashX的增强模式",
"quality_rules": [
"使用npm run dev:simple启动开发服务器",
"代码修改后需npm run build重新构建",
"dev-server.mjs会自动添加CORS头"
]
},
"pat-002": {
"name": "Axios响应数据嵌套结构",
"source": "implementation_review",
"confidence": 0.95,
"applications": 1,
"created": "2026-03-22",
"category": "frontend",
"pattern": "API响应是{code, message, data{...}}嵌套结构直接访问res.data.token是undefined",
"problem": "登录成功后token存储为undefined导致isLoggedIn返回false",
"solution": "使用res.data.data获取实际的登录数据",
"quality_rules": [
"登录数据在res.data.data中不是在res.data中",
"访问嵌套数据前先console.log打印确认结构"
]
},
"pat-003": {
"name": "CORS配置端口限制",
"source": "implementation_review",
"confidence": 0.85,
"applications": 2,
"created": "2026-03-22",
"category": "backend",
"pattern": "后端CORS只允许特定端口导致跨域失败",
"problem": "前端使用不同端口时API请求被CORS阻止",
"solution": "CORS配置中添加所有可能的前端开发端口5173-5180",
"quality_rules": [
"后端CorsConfiguration设置allowedOrigins包含所有开发端口",
"前端request.ts的baseURL使用绝对路径http://localhost:8080/api"
]
},
"pat-004": {
"name": "dist构建产物未及时更新",
"source": "user_feedback",
"confidence": 0.80,
"applications": 3,
"created": "2026-03-22",
"category": "workflow",
"pattern": "修改代码后构建产物没有更新",
"problem": "前端修改后没有重新npm run build",
"solution": "建立标准流程:修改代码 → npm run build → 重启dev-server",
"quality_rules": [
"每次测试前确认dist是最新的",
"使用dev-server.mjs时每次修改都需要重新构建"
]
},
"pat-005": {
"name": "登录跳转使用window.location.href",
"source": "implementation_review",
"confidence": 0.90,
"applications": 2,
"created": "2026-03-22",
"category": "frontend",
"pattern": "SPA登录成功后router.push('/')不工作",
"problem": "Pinia store更新和Vue Router跳转时序问题",
"solution": "使用window.location.href = '/'强制页面重新加载",
"quality_rules": [
"登录回调中使用window.location.href进行跳转",
"登出时也使用window.location.href = '/login'"
]
}
}
}