Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
98d50d53
authored
Aug 29, 2026
by
Seefs
Committed by
GitHub
Aug 29, 2026
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(web): recheck setup status after page reload (#6968)
parent
0f2a2075
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
33 deletions
+5
-33
web/src/routes/__root.tsx
+5
-33
No files found.
web/src/routes/__root.tsx
View file @
98d50d53
...
...
@@ -107,37 +107,8 @@ function RootComponent() {
)
}
// 缓存 setup 状态检查结果,避免每次导航都重复调用 API
// 使用 localStorage 持久化,避免页面刷新后重复检查
const
SETUP_CHECKED_KEY
=
'setup_status_checked'
function
getSetupStatusFromCache
():
boolean
{
try
{
if
(
typeof
window
!==
'undefined'
)
{
return
window
.
localStorage
.
getItem
(
SETUP_CHECKED_KEY
)
===
'true'
}
}
catch
{
/* empty */
}
return
false
}
function
setSetupStatusCache
(
value
:
boolean
):
void
{
try
{
if
(
typeof
window
!==
'undefined'
)
{
if
(
value
)
{
window
.
localStorage
.
setItem
(
SETUP_CHECKED_KEY
,
'true'
)
}
else
{
window
.
localStorage
.
removeItem
(
SETUP_CHECKED_KEY
)
}
}
}
catch
{
/* empty */
}
}
// 内存中的标记,避免同一会话中重复检查
let
setupStatusChecked
=
getSetupStatusFromCache
()
// 同一页面会话内避免重复检查;刷新后重新校验当前服务实例。
let
setupStatusChecked
=
false
export
const
Route
=
createRootRouteWithContext
<
{
queryClient
:
QueryClient
...
...
@@ -167,11 +138,12 @@ export const Route = createRootRouteWithContext<{
authBootstrap
,
])
if
(
status
?.
success
&&
status
.
data
&&
!
status
.
data
.
status
)
{
if
(
status
?.
success
&&
status
.
data
)
{
if
(
!
status
.
data
.
status
)
{
throw
redirect
({
to
:
'/setup'
})
}
setupStatusChecked
=
true
setSetupStatusCache
(
true
)
}
}
else
{
await
authBootstrap
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment