Skip to content

Commit bb5e3f0

Browse files
IndependentPanel: Remove redundant remount toggle; rely on key
Drop the renderContent flag and its timeout flip. Rely solely on the key={sessionId} to trigger remount when switching sessions, reducing complexity and avoiding duplicated rerenders.
1 parent 667695b commit bb5e3f0

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

src/pages/IndependentPanel/App.jsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ function App() {
2525
const [sessions, setSessions] = useState([])
2626
const [sessionId, setSessionId] = useState(null)
2727
const [currentSession, setCurrentSession] = useState(null)
28-
const [renderContent, setRenderContent] = useState(false)
2928
const [searchQuery, setSearchQuery] = useState('')
3029
const [debouncedQuery, setDebouncedQuery] = useState('')
3130
const currentPort = useRef(null)
@@ -84,10 +83,6 @@ function App() {
8483
;(async () => {
8584
if (sessions.length > 0) {
8685
setCurrentSession((await getSession(sessionId)).session)
87-
setRenderContent(false)
88-
setTimeout(() => {
89-
setRenderContent(true)
90-
})
9186
}
9287
})()
9388
}, [sessionId])
@@ -305,7 +300,7 @@ function App() {
305300
</div>
306301
</div>
307302
<div className="chat-content">
308-
{renderContent && currentSession && currentSession.conversationRecords && (
303+
{currentSession && currentSession.conversationRecords && (
309304
<div
310305
key={currentSession.sessionId}
311306
className="chatgptbox-container"

0 commit comments

Comments
 (0)