Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sdream-ai-fe
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
侯明涛
sdream-ai-fe
Commits
351d1015
Commit
351d1015
authored
Dec 23, 2025
by
Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:会话id存入localStorage
parent
584fe21f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletions
+5
-1
src/layouts/Navbar/Navbar.tsx
+5
-1
No files found.
src/layouts/Navbar/Navbar.tsx
View file @
351d1015
...
...
@@ -12,6 +12,7 @@ import { withAuth } from '@/auth/withAuth'
import
{
NAV_BAR_ITEMS
}
from
'@/config/nav'
import
{
useAppDispatch
,
useAppSelector
}
from
'@/store/hook'
import
{
isMobile
}
from
'@/utils'
import
{
safeLocalStorageSetItem
}
from
'@/lib/utils'
// import { User } from './components/User'
interface
NavbarProps
{
...
...
@@ -135,9 +136,12 @@ const NavbarBase: React.FC<NavbarProps & WithAuthProps> = ({ isHistoryVisible, c
}
},
[
shouldNavigateToNewConversation
,
currentConversationId
,
currentToolId
,
navigate
,
dispatch
])
// keep latest conversation id in
sessionStorage for cross-page returns (e.g., from collect
)
// keep latest conversation id in
localStorage (persists across page closes) and sessionStorage (for cross-page returns
)
useEffect
(()
=>
{
if
(
currentConversationId
)
{
// 保存到 localStorage,关闭页面后仍能恢复
safeLocalStorageSetItem
(
'currentConversationId'
,
currentConversationId
)
// 同时保存到 sessionStorage,用于跨页面返回(如从收藏页返回)
sessionStorage
.
setItem
(
'currentConversationId'
,
currentConversationId
)
}
},
[
currentConversationId
])
...
...
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