v0.8.1 修复启动竞态:静默登录失败时会话恢复未校验缓存库绑定导致视图挂载读库崩溃;退出登录先卸载视图再解绑
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
# v0.8.1 修复启动竞态崩溃
|
||||
|
||||
## 修复
|
||||
- 修复「Cannot read properties of undefined (reading 'attendance')」启动崩溃:当本机存有登录会话但静默登录失败时(典型场景:服务器重启/重建容器的窗口期打开应用),旧版会按已登录渲染但本地缓存库未绑定,视图挂载即崩溃。
|
||||
- 现在会话恢复会校验本地缓存库已绑定;未绑定则回到登录页,重新登录即可(服务器恢复后一次点击进入)。
|
||||
- 退出登录改为先卸载视图再解绑缓存库,消除微任务间隙的同类崩溃窗口。
|
||||
|
||||
## 说明
|
||||
- 该问题为潜伏缺陷,服务器重建窗口期触发;v0.8.0 功能本身不受影响。
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+2
-2
@@ -1,2 +1,2 @@
|
||||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./web-oDK3lWem.js","./index-BI5aMIlx.js","./index-CwfY7_G6.css"])))=>i.map(i=>d[i]);
|
||||
import{r as s,_ as i}from"./index-BI5aMIlx.js";var t;(function(e){e.Documents="DOCUMENTS",e.Data="DATA",e.Library="LIBRARY",e.Cache="CACHE",e.External="EXTERNAL",e.ExternalStorage="EXTERNAL_STORAGE"})(t||(t={}));var a;(function(e){e.UTF8="utf8",e.ASCII="ascii",e.UTF16="utf16"})(a||(a={}));const E=s("Filesystem",{web:()=>i(()=>import("./web-oDK3lWem.js"),__vite__mapDeps([0,1,2]),import.meta.url).then(e=>new e.FilesystemWeb)});export{t as Directory,a as Encoding,E as Filesystem};
|
||||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./web-DCGLAtF7.js","./index-COEpAapF.js","./index-BWain5t9.css"])))=>i.map(i=>d[i]);
|
||||
import{r as s,_ as i}from"./index-COEpAapF.js";var t;(function(e){e.Documents="DOCUMENTS",e.Data="DATA",e.Library="LIBRARY",e.Cache="CACHE",e.External="EXTERNAL",e.ExternalStorage="EXTERNAL_STORAGE"})(t||(t={}));var a;(function(e){e.UTF8="utf8",e.ASCII="ascii",e.UTF16="utf16"})(a||(a={}));const E=s("Filesystem",{web:()=>i(()=>import("./web-DCGLAtF7.js"),__vite__mapDeps([0,1,2]),import.meta.url).then(e=>new e.FilesystemWeb)});export{t as Directory,a as Encoding,E as Filesystem};
|
||||
+10
-10
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+2
-2
@@ -8,8 +8,8 @@
|
||||
<link rel="icon" href="./icons/icon.svg" type="image/svg+xml" />
|
||||
<link rel="apple-touch-icon" href="./icons/icon-192.png" />
|
||||
<title>实习工作日志</title>
|
||||
<script type="module" crossorigin src="./assets/index-BI5aMIlx.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="./assets/index-CwfY7_G6.css">
|
||||
<script type="module" crossorigin src="./assets/index-COEpAapF.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="./assets/index-BWain5t9.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "intern-log",
|
||||
"private": true,
|
||||
"version": "0.8.0",
|
||||
"version": "0.8.1",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -19,12 +19,14 @@ import { getWorkRule, getWeeklyNote, searchLogItems, searchMemos } from './db/re
|
||||
import { todayStr, weekStart } from './lib/date'
|
||||
import { showToast, useToasts } from './lib/toast'
|
||||
import { focusDate, focusMemo } from './lib/bus'
|
||||
import { categoryLabel, type LogItem, type Memo } from './db/schema'
|
||||
import { categoryLabel, db, type LogItem, type Memo } from './db/schema'
|
||||
|
||||
const toasts = useToasts()
|
||||
|
||||
// ---- 用户会话(持久化登录,退出走顶栏按钮)----
|
||||
const session = ref<Session | null>(getSession())
|
||||
// 会话恢复必须确认本地缓存库已绑定:静默登录失败(如服务器重启窗口期)时
|
||||
// db 仍为 undefined,此时退回登录页,避免视图挂载即读库崩溃
|
||||
const session = ref<Session | null>(getSession() && db ? getSession() : null)
|
||||
async function onLogin(s: Session) {
|
||||
session.value = s
|
||||
openUserDatabase(s.userId)
|
||||
@@ -48,8 +50,8 @@ async function doLogout() {
|
||||
moreOpen.value = false
|
||||
stopRealtime()
|
||||
if (syncTimer !== null) { window.clearInterval(syncTimer); syncTimer = null }
|
||||
session.value = null // 先卸载视图再解绑缓存库,避免微任务间隙读到已关闭的库
|
||||
await logoutUser()
|
||||
session.value = null
|
||||
route.value = 'calendar'
|
||||
location.hash = '#/calendar'
|
||||
showToast('已退出登录')
|
||||
|
||||
Reference in New Issue
Block a user